<template>
  <div class="app-container">
    <el-tabs type="card" v-model="activeName">
      <el-tab-pane label="地图" name="first" v-loading="loading">
        <!--地图-->
        <SpaceDataMap v-if="completeRefreshSpaceData==true"
                      :showHideDivType="showHideDivType"
                      @showHideUploadDiv="showHideUploadDiv"
                      @showHideManageDiv="showHideManageDiv"
                      @showHideQueryDiv="showHideQueryDiv"
                      @showDetailId="showDetailId"
                      :showHideTextLayerBool="showHideTextLayerBool"
                      :rkgwLegendSelectData="rkgwLegendSelectData"
                      :xzqhLayerBool="xzqhLayerBool" :xzqhAllData="xzqhAllData"
                      :dxdmGcLayerBool="dxdmGcLayerBool" :dxdmGcAllData="dxdmGcAllData"
                      :dxdmPdLayerBool="dxdmPdLayerBool" :dxdmPdAllData="dxdmPdAllData"
                      :rkgwLayerBool="rkgwLayerBool" :rkgwAllData="rkgwAllData"
                      :jtDlLayerBool="jtDlLayerBool" :jtDlAllData="jtDlAllData"
                      :jtJcLayerBool="jtJcLayerBool" :jtJcAllData="jtJcAllData"
                      :skLayerBool="skLayerBool" :skAllData="skAllData"
                      :schoolLayerBool="schoolLayerBool" :schoolAllData="schoolAllData"
                      :dzzhLayerBool="dzzhLayerBool" :dzzhAllData="dzzhAllData"
                      :dcLayerBool="dcLayerBool" :dcAllData="dcAllData"
                      :csWhqyLayerBool="csWhqyLayerBool" :csWhqyAllData="csWhqyAllData"
                      :csJyzLayerBool="csJyzLayerBool" :csJyzAllData="csJyzAllData"
                      :yjbncsLayerBool="yjbncsLayerBool" :yjbncsAllData="yjbncsAllData"
                      :hospitalLayerBool="hospitalLayerBool" :hospitalAllData="hospitalAllData"
                      :fwkznlLayerBool="fwkznlLayerBool" :fwkznlAllData="fwkznlAllData"
                      :slopeLegendData="slopeLegendData"
                      :elevationLegendData="elevationLegendData"
                      :fwkznlLegendData="fwkznlLegendData"
                      :queryMapBool="queryMapBool"
                      @showQueryMapDraw="showQueryMapDraw"
                      @getMap="getMap"
                      @mapClick="mapClick"
        ></SpaceDataMap>
        <!--图层图例-->
        <div class="new-layerLegendDiv">
          <p @click="showHideLayerDiv">
            <template v-if="showHideLayerDivBool">
              <img title="打开图层选择" src="@/assets/map/image/newImage/layer.png"><br/><span style="color:#3a385e;">图层</span>
            </template>
            <template v-else>
              <img title="关闭图层选择" src="@/assets/map/image/newImage/layer-r.png"><br/><span style="color:var(--el-color-primary);">图层</span>
            </template>
          </p>
          <p class="new-layerLengendDiv-split"></p>
          <p @click="showHideLegendDiv">
            <template v-if="showHideLegendDivBool">
              <img title="打开图例" src="@/assets/map/image/newImage/legend.png"><br/><span style="color:#3a385e;">图例</span>
            </template>
            <template v-else>
              <img title="关闭图例" src="@/assets/map/image/newImage/legend.png"><br/><span style="color:var(--el-color-primary);">图例</span>
            </template>
          </p>
          <p class="new-layerLengendDiv-split"></p>
          <p @click="showHideTextLayer">
            <template v-if="showHideTextLayerBool==false">
              <img title="显示文字" src="@/assets/map/image/newImage/legend.png"><br/><span style="color:#3a385e;">文字</span>
            </template>
            <template v-else>
              <img title="隐藏文字" src="@/assets/map/image/newImage/legend.png"><br/><span style="color:var(--el-color-primary);">文字</span>
            </template>
          </p>
        </div>
        <!--图层选择-->
        <div v-if="showHideLayerDivBool==false" class="new-layerSelectDiv">
          <el-radio v-model="layerRadio" label="1" @change="layerRadioSelect">国家级数据</el-radio>
          <el-radio v-model="layerRadio" label="2" @change="layerRadioSelect">省级数据</el-radio>
          <el-cascader v-model="layerSelectData" placeholder="请选择图层"
                       :options="layerOptions" :props="layerProps" @change="chooseLayers"
                       separator="," collapse-tags collapse-tags-tooltip clearable></el-cascader>
        </div>
        <!--图例-->
        <div v-if="showHideLegendDivBool==false" class="new-legendDiv">
          <div style="text-align: center;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">图例</span>
          </div>
          <div v-if="xzqhLayerBool">
            <div><div style="border-color:rgb(5 5 233);" class="new-legendDiv-polygon"></div></div>
            <span>行政区划</span>
          </div>
          <div v-if="dxdmGcLayerBool" @mouseover="elevationLegendMouseOver">
            <div><div style="border-color:gray;" class="new-legendDiv-polygon"></div></div>
            <span>地形地貌（高程）</span>
          </div>
          <div v-if="dxdmPdLayerBool" @mouseover="slopeLegendMouseOver">
            <div><div style="border-color:gray;" class="new-legendDiv-polygon"></div></div>
            <span>地形地貌（坡度）</span>
          </div>
          <div v-if="rkgwLayerBool" @mouseover="rkgwLegendMouseOver">
            <div><div style="border-color:#ffa500;" class="new-legendDiv-polygon"></div></div>
            <span>人口建筑物经济公里格网</span>
          </div>
          <div v-if="jtDlLayerBool">
            <div><div style="background:#000000;" class="new-legendDiv-line"></div></div>
            <span>交通（道路）</span>
          </div>
          <div v-if="jtJcLayerBool">
            <div><div style="background:#008000;" class="new-legendDiv-point"></div></div>
            <span>交通（机场）</span>
          </div>
          <div v-if="skLayerBool">
            <div><div style="background:#0000ff;" class="new-legendDiv-point"></div></div>
            <span>水库</span>
          </div>
          <div v-if="schoolLayerBool">
            <div><div style="background:rgb(0,134,84);" class="new-legendDiv-point"></div></div>
            <span>学校</span>
          </div>
          <div v-if="dzzhLayerBool">
            <div><div style="background:#ff0000;" class="new-legendDiv-point"></div></div>
            <span>地质灾害</span>
          </div>
          <div v-if="dcLayerBool">
            <div><div style="background:red;" class="new-legendDiv-line"></div></div>
            <span>断层</span>
          </div>
          <div v-if="csWhqyLayerBool">
            <div><div style="background:#800080;" class="new-legendDiv-point"></div></div>
            <span>次生灾害危险源（危化企业）</span>
          </div>
          <div v-if="csJyzLayerBool">
            <div><div style="background:rgb(244,111,68);" class="new-legendDiv-point"></div></div>
            <span>次生灾害危险源（加油站）</span>
          </div>
          <div v-if="yjbncsLayerBool">
            <div><div style="background:rgb(127,203,164);" class="new-legendDiv-point"></div></div>
            <span>应急避难场所</span>
          </div>
          <div v-if="hospitalLayerBool">
            <div>
              <div style="background:brown;" class="new-legendDiv-point">
                <img src="@/assets/map/image/newImage/hospital.png" title="医院" style="height:16px;margin-left: -2px;">
              </div>
            </div>
            <span>医院</span>
          </div>
          <div v-if="fwkznlLayerBool" @mouseover="fwkznlLegendMouseOver">
            <div><div style="border-color:#f08080;" class="new-legendDiv-polygon"></div></div>
            <span>房屋抗震能力分区图</span>
          </div>
        </div>
        <!--人口建筑物经济公里格网图例-->
        <div v-if="rkgwLegendBool==true" class="new-rkgwLegendDiv">
          <div style="text-align: center;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">人口建筑物经济公里格网图例设置</span>
          </div>
          <el-radio-group v-model="rkgwLegendRadio" @change="rkgwLegendRadioSelect" style="height: 27px;">
            <el-radio label="1">人口</el-radio>
            <el-radio label="2">建筑物</el-radio>
            <el-radio label="3">经济</el-radio>
          </el-radio-group>
          <template v-if="rkgwLegendRadio=='1'">
            <div style="text-align: center;height: 40px;">
              <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">人口公里格网图例<br/>（单位：人/平方公里）</span>
            </div>
            <template v-for="item in rkgwLegendData1">
              <div>
                <div><div style="border-color:orange;" :style="{'background-color': item.color}" class="new-legendDiv-polygon"></div></div>
                <span>{{ item.name }}</span>
              </div>
            </template>
          </template>
          <template v-if="rkgwLegendRadio=='2'">
            <div style="text-align: center;height: 40px;">
              <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">建筑物公里格网图例<br/>（单位：平方米/平方公里）</span>
            </div>
            <template v-for="item in rkgwLegendData2">
              <div>
                <div><div style="border-color:orange;" :style="{'background-color': item.color}" class="new-legendDiv-polygon"></div></div>
                <span>{{ item.name }}</span>
              </div>
            </template>
          </template>
          <template v-if="rkgwLegendRadio=='3'">
            <div style="text-align: center;height: 40px;">
              <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">经济公里格网图例<br/>（单位：万元/平方公里）</span>
            </div>
            <template v-for="item in rkgwLegendData3">
              <div>
                <div><div style="border-color:orange;" :style="{'background-color': item.color}" class="new-legendDiv-polygon"></div></div>
                <span>{{ item.name }}</span>
              </div>
            </template>
          </template>
        </div>
        <!--高程图例-->
        <div v-if="elevationLegendBool==true" class="new-rkgwLegendDiv">
          <div style="text-align: center;height: 40px;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">高程图例<br/>（单位：米）</span>
          </div>
          <template v-for="item in elevationLegendData">
            <div>
              <div><div :style="{'background-color': item.color,'border-color': item.color}" class="new-legendDiv-polygon"></div></div>
              <span>{{ item.name }}</span>
            </div>
          </template>
        </div>
        <!--坡度图例-->
        <div v-if="slopeLegendBool==true" class="new-rkgwLegendDiv">
          <div style="text-align: center;height: 40px;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">坡度图例<br/>（单位：度）</span>
          </div>
          <template v-for="item in slopeLegendData">
            <div>
              <div><div :style="{'background-color': item.color,'border-color': item.color}" class="new-legendDiv-polygon"></div></div>
              <span>{{ item.name }}</span>
            </div>
          </template>
        </div>
        <!--房屋抗震能力分区图图例-->
        <div v-if="fwkznlLegendBool==true" class="new-rkgwLegendDiv">
          <div style="text-align: center;height: 20px;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">房屋抗震能力分区图图例</span>
          </div>
          <template v-for="item in fwkznlLegendData">
            <div>
              <div><div :style="{'background-color': item.color,'border-color': item.color}" class="new-legendDiv-polygon"></div></div>
              <span>{{ item.name }}</span>
            </div>
          </template>
        </div>
        <!--上传面板-->
        <div v-if="showHideUploadDivBool" class="new-uploadDiv">
          <div class="new-uploadDiv-inner">
            <el-form :model="uploadParams" label-position="right" label-width="82px">
              <el-form-item label="省" prop="province">
                <el-select v-model="uploadParams.province" placeholder="请选择" @change="chooseProvince" clearable value-key="name"
                           :disabled="provinceData.length==1">
                  <el-option v-for="item in provinceData" :key="item.id" :label="item.name" :value="item">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="市" prop="city">
                <el-select v-model="uploadParams.city" placeholder="请选择" @change="chooseCity" clearable value-key="name">
                  <el-option v-for="item in cityData" :key="item.id" :label="item.name" :value="item">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="区/县" prop="county">
                <el-select v-model="uploadParams.county" :disabled="uploadParams.dataType === '房屋抗震能力分区图'"
                           placeholder="请选择" @change="chooseCounty" clearable value-key="name">
                  <el-option v-for="item in areaData" :key="item.id" :label="item.name" :value="item">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="数据类型" prop="dataType">
                <el-select v-model="uploadParams.dataType" placeholder="请选择" @change="setFileInfoTableData" clearable value-key="name">
                  <el-option v-for="item in dataType" :key="item.code" :label="item.name" :value="item.name">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form>
            <div class="new-fileBtn">
              <input type="file" @change="uploadFileChange" style="width: 70px;" id="spaceData-button-selectfile" multiple="multiple" accept=".shp,.dbf,.prj,.sbn,.sbx,.shp.xml,.shx,.cpg" />
            </div>
            <div class="new-fieldInfoBtn">
              <a @click="showFieldDialog"><h5>字段说明</h5></a>
            </div>
            <div class="new-filesTextArea">
              <el-input type="textarea" :rows="10" placeholder="导入多个文件时，文件名须相同" v-model="textarea" readonly></el-input>
            </div>
            <div class="new-uploadBtnDiv">
              <el-button @click="uploadFileClick" type="primary">上传</el-button>
            </div>
            <div class="new-closeBtnDiv">
              <el-button plain @click="showHideUploadDiv(false)">关闭</el-button>
            </div>
          </div>
        </div>
        <!--字段说明-->
        <el-dialog title="字段说明" v-model="fieldInfoVisible">
          <div v-if="uploadParams.dataType=='地形地貌（高程）' || uploadParams.dataType=='地形地貌（坡度）'" style="margin-left: 20px;margin-top: 20px;">
            数据类型【{{uploadParams.dataType}}】应上传符合以下字段要求的tif文件.
          </div>
          <div v-else style="margin-left: 20px;margin-top: 20px;">
            数据类型【{{uploadParams.dataType}}】应上传符合以下字段要求的shp文件集合.
            <span @click="importTemplate(uploadParams.dataType)" style="color:#0D9AFF;cursor:pointer;">下载模板</span>
          </div>
          <div style="margin-left: 20px;margin-top: 20px;">
            空间数据类型：{{uploadParams.spaceType}}；
            坐标系要求：GCS_China_Geodetic_Coordinate_System_2000（EPSG:4490）
          </div>
          <div v-if="uploadParams.dataType=='地形地貌（坡度）'" style="margin-left: 20px;margin-top: 20px;">
            备注：坡度数据需上传90m精度栅格数据用于地震滑坡危险性评估逻辑斯蒂模型计算.
          </div>
          <div style="padding:20px;">
            <el-table :data="fieldInfoData"  stripe>
              <el-table-column property="number" label="序号" width="55"></el-table-column>
              <el-table-column property="type" label="数据类型" width="100"></el-table-column>
              <el-table-column property="require" label="是否必填" width="100"></el-table-column>
              <el-table-column property="name" label="数据名称" width="200"></el-table-column>
              <el-table-column property="example" label="数据说明"></el-table-column>
            </el-table>
          </div>
        </el-dialog>
        <!--管理面板-->
        <div v-if="showHideManageDivBool" class="new-queryDiv">
          <div class="new-queryDiv-inner">
            <el-form :model="queryParams" label-position="right" label-width="82px">
              <el-form-item label="省" prop="province">
                <el-select v-model="queryParams.province" placeholder="请选择" @change="chooseProvince" clearable value-key="name"
                           :disabled="provinceData.length==1">
                  <el-option v-for="item in provinceData" :key="item.id" :label="item.name" :value="item">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="市" prop="city">
                <el-select v-model="queryParams.city" placeholder="请选择" @change="chooseCity" clearable value-key="name">
                  <el-option v-for="item in cityData" :key="item.id" :label="item.name" :value="item">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="区/县" prop="county">
                <el-select v-model="queryParams.county" placeholder="请选择" @change="chooseCounty" clearable value-key="name">
                  <el-option v-for="item in areaData" :key="item.id" :label="item.name" :value="item">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="数据类型" prop="dataType">
                <el-select v-model="queryParams.dataType" placeholder="请选择" clearable value-key="name">
                  <el-option v-for="item in dataType" :key="item.code" :label="item.name" :value="item.name">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form>
            <div class="new-queryBtnDiv">
              <el-button @click="queryClick" type="primary">查询</el-button>
            </div>
            <div class="new-closeBtnDiv">
              <el-button plain @click="showHideManageDiv(false)">关闭</el-button>
            </div>
          </div>
        </div>
        <!--管理文件结果面板-->
        <div v-if="queryFileResult" class="new-queryFileResultDiv">
          <div class="new-queryTableBtn">
            <el-button @click="closeQueryFileResult" type="primary">关闭</el-button>
            <el-button @click="deleteFileResultClick" type="primary">删除</el-button>
            <el-button @click="downloadFileResultClick" type="primary">下载</el-button>
          </div>
          <div class="new-queryTableDiv">
            <el-table ref="multipleTable" :data="fileDataList" tooltip-effect="dark" height="140px"
                      @selection-change="handleSelectionChange" stripe :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}">
              <el-table-column type="selection" width="50"> </el-table-column>
              <el-table-column type="index" label="序号" width="70"></el-table-column>
              <el-table-column property="affiliatedFileName" label="文件名称" width="230"></el-table-column>
            </el-table>
          </div>
        </div>
        <!--查询面板-->
        <div v-if="showHideQueryDivBool" class="new-queryDiv">
          <div class="new-queryDiv-inner">
            <el-form :model="queryParams" label-position="right" label-width="82px">
              <el-form-item label="省" prop="province">
                <el-select v-model="queryParams.province" placeholder="请选择" @change="chooseProvince" clearable value-key="name"
                           :disabled="provinceData.length==1">
                  <el-option v-for="item in provinceData" :key="item.id" :label="item.name" :value="item">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="市" prop="city">
                <el-select v-model="queryParams.city" placeholder="请选择" @change="chooseCity" clearable value-key="name">
                  <el-option v-for="item in cityData" :key="item.id" :label="item.name" :value="item">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="区/县" prop="county">
                <el-select v-model="queryParams.county" placeholder="请选择" @change="chooseCounty" clearable value-key="name">
                  <el-option v-for="item in areaData" :key="item.id" :label="item.name" :value="item">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item label="数据类型" prop="dataType">
                <el-select v-model="queryParams.dataType" placeholder="请选择" clearable value-key="name">
                  <el-option v-for="item in dataType" :key="item.code" :label="item.name" :value="item.name">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-form>
            <div class="new-queryBtnDiv">
              <el-button v-if="queryParams.dataType!='行政区划' && queryParams.dataType!='地形地貌（高程）' && queryParams.dataType!='交通（道路）'"
                         @click="queryClick" type="primary">查询统计</el-button>
              <el-button v-else @click="queryClick" type="primary">查询</el-button>
            </div>
            <div class="new-queryMapBtnDiv" v-if="queryParams.dataType!='行政区划' && queryParams.dataType!='地形地貌（高程）' && queryParams.dataType!='交通（道路）'">
              <el-button @click="queryMapClick" type="primary">地图圈选统计</el-button>
            </div>
            <div class="new-closeBtnDiv">
              <el-button plain @click="showHideQueryDiv(false)">关闭</el-button>
            </div>
          </div>
        </div>
        <!--下方查看详情面板-->
        <div v-if="detailTable" class="new-queryResultDiv">
          <div class="new-queryTableBtn">
            <el-button @click="closeDetailResultDiv" type="primary">关闭</el-button>
            <span class="new-queryTableSpan">{{ selectType }}</span>
          </div>
          <div class="new-queryTableDiv">
            <!--行政区划-->
            <el-table v-if="selectId!=null && selectType=='行政区划'" ref="multipleTable"
                      :data="selectDataResult" tooltip-effect="dark" height="150px"
                      :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}">
              <el-table-column property="province" label="省" width="220"></el-table-column>
              <el-table-column property="city" label="市" width="220"></el-table-column>
              <el-table-column property="county" label="区（县）" width="220"></el-table-column>
              <el-table-column property="street" label="街道、乡镇" width="280"></el-table-column>
              <el-table-column property="village" label="村、社区" width="280"></el-table-column>
            </el-table>
            <!--人口建筑物经济公里格网-->
            <el-table v-if="selectId!=null && selectType=='人口建筑物经济公里格网'" ref="multipleTable"
                      :data="selectDataResult" tooltip-effect="dark" height="150px"
                      :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}">
              <el-table-column property="province" label="省" width="160"></el-table-column>
              <el-table-column property="city" label="市" width="160"></el-table-column>
              <el-table-column property="county" label="区（县）" width="160"></el-table-column>
              <el-table-column property="town" label="乡镇" width="160"></el-table-column>
              <!--<el-table-column property="id" label="Id" width="220"></el-table-column>-->
              <el-table-column property="population" label="人口（人）" width="200"></el-table-column>
              <el-table-column property="coveredarea" label="建筑面积（平方米）" width="200"></el-table-column>
              <el-table-column property="gdp" label="GDP（万元）" width="200"></el-table-column>
              <el-table-column property="townorcontry" label="城镇/农村" width="150"></el-table-column>
              <el-table-column property="jglxGcjz" label="高层建筑占比（%）" width="160"></el-table-column>
              <el-table-column property="jglxGjg" label="钢结构占比（%）" width="160"></el-table-column>
              <el-table-column property="jglxDcgjhntjg" label="多层钢筋混凝土结构占比（%）" width="220"></el-table-column>
              <el-table-column property="jglxZhjg" label="砖混结构占比（%）" width="160"></el-table-column>
              <el-table-column property="jglxZmjg" label="砖木结构占比（%）" width="160"></el-table-column>
              <el-table-column property="jglxTjg" label="土结构占比（%）" width="160"></el-table-column>
              <el-table-column property="jglxMjg" label="木结构占比（%）" width="160"></el-table-column>
              <el-table-column property="jglxSjg" label="石结构占比（%）" width="160"></el-table-column>
              <el-table-column property="jglxQtjg" label="其他结构占比（%）" width="160"></el-table-column>
              <el-table-column property="zzfwzb" label="住宅房屋占比（%）" width="160"></el-table-column>
            </el-table>
            <!--交通（道路）-->
            <el-table v-if="selectId!=null && selectType=='交通（道路）'" ref="multipleTable"
                      :data="selectDataResult" tooltip-effect="dark" height="150px"
                      :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}">
              <el-table-column property="province" label="省" width="220"></el-table-column>
              <el-table-column property="city" label="市" width="220"></el-table-column>
              <el-table-column property="county" label="区（县）" width="220"></el-table-column>
              <!--<el-table-column property="roadId" label="Id" width="220"></el-table-column>-->
              <el-table-column property="roadName" label="名称" width="350"></el-table-column>
              <el-table-column property="roadType" label="类型" width="220"></el-table-column>
            </el-table>
            <!--交通（机场）-->
            <el-table v-if="selectId!=null && selectType=='交通（机场）'" ref="multipleTable"
                      :data="selectDataResult" tooltip-effect="dark" height="150px"
                      :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}">
              <el-table-column property="province" label="省" width="210"></el-table-column>
              <el-table-column property="city" label="市" width="210"></el-table-column>
              <el-table-column property="county" label="区（县）" width="210"></el-table-column>
              <!--<el-table-column property="airportId" label="Id" width="220"></el-table-column>-->
              <el-table-column property="airportLongitude" label="经度" width="200"></el-table-column>
              <el-table-column property="airportLatitude" label="纬度" width="200"></el-table-column>
              <el-table-column property="airportName" label="名称" width="200"></el-table-column>
            </el-table>
            <!--水库-->
            <el-table v-if="selectId!=null && selectType=='水库'" ref="multipleTable"
                      :data="selectDataResult" tooltip-effect="dark" height="150px"
                      :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}">
              <el-table-column property="province" label="省" width="160"></el-table-column>
              <el-table-column property="city" label="市" width="160"></el-table-column>
              <el-table-column property="county" label="区（县）" width="160"></el-table-column>
              <!--<el-table-column property="resId" label="Id" width="220"></el-table-column>-->
              <el-table-column property="resLongitude" label="经度" width="200"></el-table-column>
              <el-table-column property="resLatitude" label="纬度" width="200"></el-table-column>
              <el-table-column property="resName" label="名称" width="200"></el-table-column>
              <el-table-column property="resScale" label="规模" width="200"></el-table-column>
              <el-table-column property="resCapacity" label="库容量（万立方米）" width="200"></el-table-column>
              <el-table-column property="resResultType" label="结构类型" width="200"></el-table-column>
              <el-table-column property="resTime" label="建造年代" width="200"></el-table-column>
            </el-table>
            <!--学校-->
            <el-table v-if="selectId!=null && selectType=='学校'" ref="multipleTable"
                      :data="selectDataResult" tooltip-effect="dark" height="150px"
                      :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}">
              <el-table-column property="province" label="省" width="160"></el-table-column>
              <el-table-column property="city" label="市" width="160"></el-table-column>
              <el-table-column property="county" label="区（县）" width="160"></el-table-column>
              <!--<el-table-column property="schId" label="Id" width="160"></el-table-column>-->
              <el-table-column property="schReslongitude" label="经度" width="160"></el-table-column>
              <el-table-column property="schReslatitude" label="纬度" width="160"></el-table-column>
              <el-table-column property="schName" label="名称" width="160"></el-table-column>
              <el-table-column property="schType" label="类型" width="160"></el-table-column>
              <el-table-column property="schStuNum" label="学生人数" width="160"></el-table-column>
              <el-table-column property="schIsboarding" label="是否寄宿学校" width="160"></el-table-column>
            </el-table>
            <!--地质灾害-->
            <el-table v-if="selectId!=null && selectType=='地质灾害'" ref="multipleTable"
                      :data="selectDataResult" tooltip-effect="dark" height="150px"
                      :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}">
              <el-table-column property="province" label="省" width="160"></el-table-column>
              <el-table-column property="city" label="市" width="160"></el-table-column>
              <el-table-column property="county" label="区（县）" width="160"></el-table-column>
              <!--<el-table-column property="dgdId" label="Id" width="220"></el-table-column>-->
              <el-table-column property="dgdReslongitude" label="经度" width="160"></el-table-column>
              <el-table-column property="dgdReslatitude" label="纬度" width="160"></el-table-column>
              <el-table-column property="dgdName" label="名称" width="200"></el-table-column>
              <el-table-column property="dgdDisasterType" label="灾害类型" width="200"></el-table-column>
              <el-table-column property="dgdImpactPeoNum" label="影响人口数量" width="200"></el-table-column>
              <el-table-column property="dgdImpactHouseNum" label="影响房屋数量" width="200"></el-table-column>
              <el-table-column property="dgdStability" label="稳定性" width="200"></el-table-column>
              <el-table-column property="dgdDangerLevel" label="危险等级" width="200"></el-table-column>
            </el-table>
            <!--断层-->
            <el-table v-if="selectId!=null && selectType=='断层'" ref="multipleTable"
                      :data="selectDataResult" tooltip-effect="dark" height="150px"
                      :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}">
              <el-table-column property="province" label="省" width="220"></el-table-column>
              <el-table-column property="city" label="市" width="220"></el-table-column>
              <el-table-column property="county" label="区（县）" width="220"></el-table-column>
              <el-table-column property="fauNumber" label="断层编号" width="220"></el-table-column>
              <el-table-column property="fauName" label="断层名称" width="400"></el-table-column>
              <el-table-column property="fauDirection" label="断层走向[度]" width="200"></el-table-column>
            </el-table>
            <!--次生灾害危险源（危化企业）-->
            <el-table v-if="selectId!=null && selectType=='次生灾害危险源（危化企业）'" ref="multipleTable"
                      :data="selectDataResult" tooltip-effect="dark" height="150px"
                      :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}">
              <el-table-column property="province" label="省" width="160"></el-table-column>
              <el-table-column property="city" label="市" width="160"></el-table-column>
              <el-table-column property="county" label="区（县）" width="160"></el-table-column>
              <!--<el-table-column property="redId" label="Id" width="220"></el-table-column>-->
              <el-table-column property="redLongitude" label="经度" width="160"></el-table-column>
              <el-table-column property="redLatitude" label="纬度" width="160"></el-table-column>
              <el-table-column property="redName" label="企业名" width="200"></el-table-column>
              <el-table-column property="redAddress" label="地址" width="300"></el-table-column>
              <el-table-column property="redType" label="危化品类型" width="400"></el-table-column>
              <el-table-column property="redScale" label="规模" width="400"></el-table-column>
              <el-table-column property="redRiskgrade" label="风险等级" width="200"></el-table-column>
              <el-table-column property="sfzdyh" label="是否重点隐患" width="200">
                <template #default="scope">
                  <span>{{ sfzdyhDictData(scope.row.sfzdyh) }}</span>
                </template>
              </el-table-column>
            </el-table>
            <!--次生灾害危险源（加油站）-->
            <el-table v-if="selectId!=null && selectType=='次生灾害危险源（加油站）'" ref="multipleTable"
                      :data="selectDataResult" tooltip-effect="dark" height="150px"
                      :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}">
              <el-table-column property="province" label="省" width="160"></el-table-column>
              <el-table-column property="city" label="市" width="160"></el-table-column>
              <el-table-column property="county" label="区（县）" width="160"></el-table-column>
              <!--<el-table-column property="gsId" label="Id" width="220"></el-table-column>-->
              <el-table-column property="gsLongitude" label="经度" width="160"></el-table-column>
              <el-table-column property="gsLatitude" label="纬度" width="160"></el-table-column>
              <el-table-column property="gsName" label="名称" width="200"></el-table-column>
              <el-table-column property="gsAddress" label="地址" width="300"></el-table-column>
              <el-table-column property="gsScale" label="规模" width="160"></el-table-column>
              <el-table-column property="gsRiskgrade" label="风险等级" width="160"></el-table-column>
              <el-table-column property="sfzdyh" label="是否重点隐患" width="200">
                <template #default="scope">
                  <span>{{ sfzdyhDictData(scope.row.sfzdyh) }}</span>
                </template>
              </el-table-column>
            </el-table>
            <!--应急避难场所-->
            <el-table v-if="selectId!=null && selectType=='应急避难场所'" ref="multipleTable"
                      :data="selectDataResult" tooltip-effect="dark" height="150px"
                      :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}">
              <el-table-column property="province" label="省" width="160"></el-table-column>
              <el-table-column property="city" label="市" width="160"></el-table-column>
              <el-table-column property="county" label="区（县）" width="160"></el-table-column>
              <!--<el-table-column property="esId" label="Id" width="220"></el-table-column>-->
              <el-table-column property="esLongitude" label="经度" width="160"></el-table-column>
              <el-table-column property="esLatitude" label="纬度" width="160"></el-table-column>
              <el-table-column property="esName" label="名称" width="250"></el-table-column>
              <el-table-column property="esType" label="类型" width="160"></el-table-column>
              <el-table-column property="esAddress" label="具体地址" width="250"></el-table-column>
              <el-table-column property="esMaxpeople" label="可容纳人数" width="160"></el-table-column>
              <el-table-column property="esEmergencysupportequipment" label="有无应急保障设备" width="160"></el-table-column>
            </el-table>
            <!--医院-->
            <el-table v-if="selectId!=null && selectType=='医院'" ref="multipleTable"
                      :data="selectDataResult" tooltip-effect="dark" height="150px"
                      :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}">
              <el-table-column property="province" label="省" width="160"></el-table-column>
              <el-table-column property="city" label="市" width="160"></el-table-column>
              <el-table-column property="county" label="区（县）" width="160"></el-table-column>
              <!--<el-table-column property="dhId" label="Id" width="220"></el-table-column>-->
              <el-table-column property="dhLongitude" label="经度" width="160"></el-table-column>
              <el-table-column property="dhLatitude" label="纬度" width="160"></el-table-column>
              <el-table-column property="dhName" label="名称" width="200"></el-table-column>
              <el-table-column property="dhType" label="类型" width="160"></el-table-column>
              <el-table-column property="dhPower" label="医疗力量（人数）" width="160"></el-table-column>
              <el-table-column property="dhBedNum" label="床位数" width="160"></el-table-column>
              <el-table-column property="dhAddress" label="地址" width="200"></el-table-column>
            </el-table>
            <!--房屋抗震能力分区图-->
            <el-table v-if="selectId!=null && selectType=='房屋抗震能力分区图'" ref="multipleTable"
                      :data="selectDataResult" tooltip-effect="dark" height="150px"
                      :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}">
              <!--<el-table-column property="kztNumber" label="Id" width="220"></el-table-column>-->
              <el-table-column property="province" label="省" width="160"></el-table-column>
              <el-table-column property="city" label="市" width="160"></el-table-column>
              <!--<el-table-column property="county" label="区（县）" width="220"></el-table-column>-->
              <el-table-column property="kztCounties" label="区（县）" width="200"></el-table-column>
              <el-table-column property="kztStreet" label="街道、乡镇" width="200"></el-table-column>
              <el-table-column property="kztVillage" label="村、社区" width="200"></el-table-column>
              <el-table-column property="kztShockresistance" label="抗震能力初判结果" width="200"></el-table-column>
              <el-table-column property="kztShockresistancenumber" label="当前抗震能力下房屋栋数" width="200"></el-table-column>
              <el-table-column property="kztArea" label="面积" width="160"></el-table-column>
            </el-table>
          </div>
        </div>
        <!--空间统计图表-->
        <ChartsView :chartViewQueryParams="chartViewQueryParams" @hideChartView="hideChartView"></ChartsView>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script setup name="spaceData">
//地图
import SpaceDataMap from '@/map/basedatamanage/spaceData/map.vue';
import ChartsView from '@/views/basedatamanage/spaceData/chartsView.vue';
import { getProvince, getChildArea } from "@/api/system/division";
import { getAllFile, getAllAreaData, getAreaDataById, delAreaFileData, uploadAreaFiles,
  getAllSlopeData, getSlopeDataById, delSlopeFileData, uploadSlopeFiles,
  getAllElevationData, getElevationDataById, delElevationFileData, uploadElevationFiles,
  getAllPbeData, getPbeDataById, delPbeFileData, uploadPbeFiles,
  getAllRoadData, getRoadDataById, delRoadFileData, uploadRoadFiles,
  getAllAirportData, getAirportDataById, delAirportFileData, uploadAirportFiles,
  getAllReservoirData, getReservoirDataById, delReservoirFileData, uploadReservoirFiles,
  getAllSchoolData, getSchoolDataById, delSchoolFileData, uploadSchoolFiles,
  getAllGeologicalData, getGeologicalDataById, delGeologicalFileData, uploadGeologicalFiles,
  getAllFaultageData, getFaultageDataById, delFaultageFileData, uploadFaultageFiles,
  getAllRiskEnterpriseData, getRiskEnterpriseDataById, delRiskEnterpriseFileData, uploadRiskEnterpriseFiles,
  getAllGasstationData, getGasstationDataById, delGasstationFileData, uploadGasstationFiles,
  getAllEmergencyShelterData, getEmergencyShelterDataById, delEmergencyShelterFileData, uploadEmergencyShelterFiles,
  getAllHospitalData, getHospitalDataById, delHospitalFileData, uploadHospitalFiles,
  getAllKangZhenTuData, getKangZhenTuDataById, delKangZhenTuFileData, uploadKangZhenTuFiles,lookUpMapFilesByLevel
} from "@/api/basedatamanage/spaceData";
import { getLanderRoles, getLanderProvince } from "@/api/basedatamanage/common.js"
import { getDict } from "@/api/system/dict";
//import { uploadDistrictBoundaryFiles } from "@/api/taskmanage/taskRegionQuery";//TEST
import { ElMessage, ElMessageBox } from 'element-plus'
import { getGridLayer } from '@/map/projMap.js';
import { getSqlTempLayer } from '@/map/sqlTempLayersSet.js';
import { queryFeatureByLonLat } from '@/map/queryLayerFeature.js';

const { proxy } = getCurrentInstance();
const activeName = ref("first");
const loading = ref(false);
const showHideUploadDivBool = ref(false);//是否显示上传面板
const showHideManageDivBool = ref(false);//是否显示管理面板
const showHideQueryDivBool = ref(false);//是否显示查询面板
const showHideDivType = ref("");
const queryFileResult = ref(false);//是否显示查询文件结果面板
const detailTable = ref(false);//是否显示下方查看详情面板
const multipleSelection = ref([]);
const fieldInfoVisible = ref(false);//是否显示字段说明
const fileDataList = ref([]);//查询文件列表
const showHideLayerDivBool = ref(true);//是否显示图层选择面板
const showHideLegendDivBool = ref(true);//是否显示图例面板
const showHideTextLayerBool = ref(false);//是否显示文字图层
const layerRadio = ref("2");//国家级数据/省级数据
const layerProps = ref({ multiple: true });//图层选择--多选
const layerSelectData = ref([]);//图层选择内容
const tempLayerSelectData = ref([]);//上一次图层选择内容
const rkgwLegendRadio = ref("0");//人口/建筑物/经济
//数据类型
const dataTypeInfoArray = ref([
  //预评估系统
  {database:"fxfzypg", name: '行政区划', code: 'data_area', table:"data_area",url:"/iserver/services/map-fxfzypg/rest/maps/data_area@fxfzypg",zIndex:6,fieldId:"area_id",sqlFilter:"is_delete='0'"},
  {database:"fxfzypg", name: '地形地貌（高程）', code: 'dxdmgc', table:"",url:"/iserver/services/map-demtif/rest/maps/",zIndex:6,fieldId:"",sqlFilter:""},
  {database:"fxfzypg", name: '地形地貌（坡度）', code: 'dxdmpd', table:"",url:"/iserver/services/map-demtif/rest/maps/",zIndex:6,fieldId:"",sqlFilter:""},
  {database:"fxfzypg", name: '人口建筑物经济公里格网', code: 'data_pbe', table:"data_pbe",url:"/iserver/services/map-fxfzypg/rest/maps/data_pbe@fxfzypg",zIndex:6,fieldId:"pbe_id",sqlFilter:"isdelete='0'"},
  {database:"fxfzypg", name: '人口公里格网', code: 'data_pbe_population', table:"data_pbe",url:"/iserver/services/map-fxfzypg/rest/maps/data_pbe_population@fxfzypg",zIndex:6,fieldId:"pbe_id",sqlFilter:"isdelete='0'"},
  {database:"fxfzypg", name: '建筑物公里格网', code: 'data_pbe_building', table:"data_pbe",url:"/iserver/services/map-fxfzypg/rest/maps/data_pbe_building@fxfzypg",zIndex:6,fieldId:"pbe_id",sqlFilter:"isdelete='0'"},
  {database:"fxfzypg", name: '经济公里格网', code: 'data_pbe_gdp', table:"data_pbe",url:"/iserver/services/map-fxfzypg/rest/maps/data_pbe_gdp@fxfzypg",zIndex:6,fieldId:"pbe_id",sqlFilter:"isdelete='0'"},
  {database:"fxfzypg", name: '交通（道路）', code: 'sys_road', table:"sys_road",url:"/iserver/services/map-fxfzypg/rest/maps/sys_road@fxfzypg",zIndex:7,fieldId:"id",sqlFilter:"road_status='1'"},
  {database:"fxfzypg", name: '交通（机场）', code: 'sys_airport', table:"sys_airport",url:"/iserver/services/map-fxfzypg/rest/maps/sys_airport@fxfzypg",zIndex:8,fieldId:"id",sqlFilter:"airport_status='1'"},
  {database:"fxfzypg", name: '水库', code: 'data_reservoir', table:"data_reservoir",url:"/iserver/services/map-fxfzypg/rest/maps/data_reservoir@fxfzypg",zIndex:8,fieldId:"id",sqlFilter:"isdelete='1'"},
  {database:"fxfzypg", name: '学校', code: 'data_school', table:"data_school",url:"/iserver/services/map-fxfzypg/rest/maps/data_school@fxfzypg",zIndex:8,fieldId:"id",sqlFilter:"sch_isdelete='0'"},
  {database:"fxfzypg", name: '地质灾害', code: 'data_geological_disasters', table:"data_geological_disasters",url:"/iserver/services/map-fxfzypg/rest/maps/data_geological_disasters@fxfzypg",zIndex:8,fieldId:"id",sqlFilter:"dgd_isdelete='0'"},
  {database:"fxfzypg", name: '断层', code: 'data_faultage', table:"data_faultage",url:"/iserver/services/map-fxfzypg/rest/maps/data_faultage@fxfzypg",zIndex:7,fieldId:"fau_id",sqlFilter:"fau_isdelete='0'"},
  {database:"fxfzypg", name: '次生灾害危险源（危化企业）', code: 'sys_riskenterprisedata', table:"sys_riskenterprisedata",url:"/iserver/services/map-fxfzypg/rest/maps/sys_riskenterprisedata@fxfzypg",zIndex:8,fieldId:"id",sqlFilter:"red_status='1'"},
  {database:"fxfzypg", name: '次生灾害危险源（加油站）', code: 'sys_gasstationdata', table:"sys_gasstationdata",url:"/iserver/services/map-fxfzypg/rest/maps/sys_gasstationdata@fxfzypg",zIndex:8,fieldId:"id",sqlFilter:"gs_status='1'"},
  {database:"fxfzypg", name: '应急避难场所', code: 'sys_emergencyshelter', table:"sys_emergencyshelter",url:"/iserver/services/map-fxfzypg/rest/maps/sys_emergencyshelter@fxfzypg",zIndex:8,fieldId:"id",sqlFilter:"es_status='1'"},
  {database:"fxfzypg", name: '医院', code: 'data_hospital', table:"data_hospital",url:"/iserver/services/map-fxfzypg/rest/maps/data_hospital@fxfzypg",zIndex:8,fieldId:"id",sqlFilter:"dh_isdelete='1'"},
  {database:"fxfzypg", name: '房屋抗震能力分区图', code: 'sys_kangzhentu', table:"sys_kangzhentu",url:"/iserver/services/map-fxfzypg/rest/maps/sys_kangzhentu@fxfzypg",zIndex:6,fieldId:"id",sqlFilter:"kzt_status='1'"},
]);
//图层显示
const xzqhLayerBool = ref(false);//行政区划图层显示
const dxdmGcLayerBool = ref(false);//地形地貌（高程）图层显示
const dxdmPdLayerBool = ref(false);//地形地貌（坡度）图层显示
const rkgwLayerBool = ref(false);//人口建筑物经济公里格网图层显示
const jtDlLayerBool = ref(false);//交通（道路）图层显示
const jtJcLayerBool = ref(false);//交通（机场）图层显示
const skLayerBool = ref(false);//水库图层显示
const schoolLayerBool = ref(false);//学校图层显示
const dzzhLayerBool = ref(false);//地质灾害图层显示
const dcLayerBool = ref(false);//断层图层显示
const csWhqyLayerBool = ref(false);//次生灾害危险源（危化企业）图层显示
const csJyzLayerBool = ref(false);//次生灾害危险源（加油站）图层显示
const yjbncsLayerBool = ref(false);//应急避难场所图层显示
const hospitalLayerBool = ref(false);//医院图层显示
const fwkznlLayerBool = ref(false);//房屋抗震能力分区图图层显示
//图层数据
const xzqhAllData = ref([]);//行政区划图层数据
const dxdmGcAllData = ref([]);//地形地貌（高程）图层数据
const dxdmPdAllData = ref([]);//地形地貌（坡度）图层数据
const rkgwAllData = ref([]);//人口建筑物经济公里格网图层数据
const jtDlAllData = ref([]);//交通（道路）图层数据
const jtJcAllData = ref([]);//交通（机场）图层数据
const skAllData = ref([]);//水库图层数据
const schoolAllData = ref([]);//学校图层数据
const dzzhAllData = ref([]);//地质灾害图层数据
const dcAllData = ref([]);//断层图层数据
const csWhqyAllData = ref([]);//次生灾害危险源（危化企业）图层数据
const csJyzAllData = ref([]);//次生灾害危险源（加油站）图层数据
const yjbncsAllData = ref([]);//应急避难场所图层数据
const hospitalAllData = ref([]);//医院图层数据
const fwkznlAllData = ref([]);//房屋抗震能力分区图图层数据
//选中查看详情数据
const selectId = ref(null);//选中查看详情数据Id
const selectType = ref("");//选中查看详情数据类型
const selectDataResult = ref([]);//选中查看详情数据
//图层选择
const layerOptions = ref([
  { value: '行政区划', label: '行政区划' },
  {
    value: '地形地貌',
    label: '地形地貌',
    children: [{
      value: '高程',
      label: '高程'
    }, {
      value: '坡度',
      label: '坡度',
    }]
  },
  { value: '人口建筑物经济公里格网', label: '人口建筑物经济公里格网' },
  {
    value: '交通',
    label: '交通',
    children: [{
      value: '道路',
      label: '道路'
    }, {
      value: '机场',
      label: '机场',
    }]
  },
  { value: '水库', label: '水库' },
  { value: '学校', label: '学校' },
  { value: '地质灾害', label: '地质灾害' },
  { value: '断层', label: '断层' },
  {
    value: '次生灾害危险源',
    label: '次生灾害危险源',
    children: [{
      value: '危化企业',
      label: '危化企业'
    }, {
      value: '加油站',
      label: '加油站',
    }]
  },
  { value: '应急避难场所', label: '应急避难场所' },
  { value: '医院', label: '医院' },
  { value: '房屋抗震能力分区图', label: '房屋抗震能力分区图' }
]);//图层选择--多选

const data = reactive({
  uploadParams: {
    province: "",
    city: "",
    county: "",
    type: "",//上传文件类型
    dataType:"",//数据类型
    spaceType:"",//空间数据类型：点、线、面、栅格
  },
  queryParams: {
    province: "",
    city: "",
    county: "",
    dataType: "",//数据类型
    provinceId: "",
    cityId: "",
    countyId: "",
    fileuuid:"",//当前数据所在文件UUID
  },
  layerDataQueryParams: {
    province: "",
    city: "",
    county: "",
    dataType: "",//数据类型
  },
  fieldInfoData:[],
  manageFileParams: {
    affiliatedFileName: "",//文件名
  },
  chartViewQueryParams: {//空间统计查询参数
    province: "",
    city: "",
    county: "",
    provinceId: "",
    cityId: "",
    countyId: "",
    dataType: "",//数据类型
    geomText: "",//地图圈选空间数据
    title:"",//显示空间统计标题
    showBool:false,//是否显示
  },
});
let {
  uploadParams,
  queryParams,
  layerDataQueryParams,
  fieldInfoData,
  manageFileParams,
  chartViewQueryParams
} = toRefs(data);

const provinceData = ref([]); //省
const cityData = ref([]); //市
const areaData = ref([]); //区、县
//数据类型
const dataType = ref([
  {code:"0",name:"行政区划"},
  {code:"1",name:"地形地貌（高程）"},
  {code:"2",name:"地形地貌（坡度）"},
  {code:"3",name:"人口建筑物经济公里格网"},
  {code:"4",name:"交通（道路）"},
  {code:"5",name:"交通（机场）"},
  {code:"6",name:"水库"},
  {code:"7",name:"学校"},
  {code:"8",name:"地质灾害"},
  {code:"9",name:"断层"},
  {code:"10",name:"次生灾害危险源（危化企业）"},
  {code:"11",name:"次生灾害危险源（加油站）"},
  {code:"12",name:"应急避难场所"},
  {code:"13",name:"医院"},
  {code:"14",name:"房屋抗震能力分区图"},
]);
const textarea = ref("");//上传文件只读显示文本框
const minList = ref([]);//要上传的文件的后缀名数组
const nameList = ref([]);//要上传的文件的文件名数组
const queryDataType = ref("");//查询数据类型
const rkgwLegendBool = ref(false);//是否显示人口建筑物经济公里格网图例
//数字校验/可输入小数/排除e
const validateAcquaintance = (rule, value, callback) => {
  if (value < 0 ) {
    callback(new Error('请输入大于零的数字!'))
  } else {
    callback()
  }
}
//人口格网图例范围
const rkgwLegendData1 = ref([
  {code:"0",name:"0-30",color:"rgba(230,255,230,0.8)"},
  {code:"1",name:"31-100",color:"rgba(204,255,204,0.8)"},
  {code:"2",name:"101-200",color:"rgba(179,255,179,0.8)"},
  {code:"3",name:"201-400",color:"rgba(153,255,153,0.8)"},
  {code:"4",name:"401-800",color:"rgba(128,255,128,0.8)"},
  {code:"5",name:"801-1600",color:"rgba(102,255,102,0.8)"},
  {code:"6",name:"1601-5000",color:"rgba(77,255,77,0.8)"},
  {code:"7",name:"5001-25000",color:"rgba(51,255,51,0.8)"},
  {code:"8",name:"25000以上",color:"rgba(26,255,26,0.8)"},
  // {code:"0",name:"0-30",color:"rgba(0,255,0,0.1)"},
  // {code:"1",name:"31-100",color:"rgba(0,255,0,0.2)"},
  // {code:"2",name:"101-200",color:"rgba(0,255,0,0.3)"},
  // {code:"3",name:"201-400",color:"rgba(0,255,0,0.4)"},
  // {code:"4",name:"401-800",color:"rgba(0,255,0,0.5)"},
  // {code:"5",name:"801-1600",color:"rgba(0,255,0,0.6)"},
  // {code:"6",name:"1601-5000",color:"rgba(0,255,0,0.7)"},
  // {code:"7",name:"5001-25000",color:"rgba(0,255,0,0.8)"},
  // {code:"8",name:"25000以上",color:"rgba(0,255,0,0.9)"},
]);
//建筑物格网图例范围
const rkgwLegendData2 = ref([
  {code:"0",name:"0-30",color:"rgba(255,230,230,0.8)"},
  {code:"1",name:"30-60",color:"rgba(255,204,204,0.8)"},
  {code:"2",name:"60-100",color:"rgba(255,179,179,0.8)"},
  {code:"3",name:"100-600",color:"rgba(255,153,153,0.8)"},
  {code:"4",name:"600-1200",color:"rgba(255,128,128,0.8)"},
  {code:"5",name:"1200-1600",color:"rgba(255,102,102,0.8)"},
  {code:"6",name:"1600-5000",color:"rgba(255,77,77,0.8)"},
  {code:"7",name:"5000-15000",color:"rgba(255,51,51,0.8)"},
  {code:"8",name:"15000以上",color:"rgba(255,26,26,0.8)"},
  // {code:"0",name:"0-30",color:"rgba(255,0,0,0.1)"},
  // {code:"1",name:"30-60",color:"rgba(255,0,0,0.2)"},
  // {code:"2",name:"60-100",color:"rgba(255,0,0,0.3)"},
  // {code:"3",name:"100-600",color:"rgba(255,0,0,0.4)"},
  // {code:"4",name:"600-1200",color:"rgba(255,0,0,0.5)"},
  // {code:"5",name:"1200-1600",color:"rgba(255,0,0,0.6)"},
  // {code:"6",name:"1600-5000",color:"rgba(255,0,0,0.7)"},
  // {code:"7",name:"5000-15000",color:"rgba(255,0,0,0.8)"},
  // {code:"8",name:"15000以上",color:"rgba(255,0,0,0.9)"},
]);
//经济格网图例范围
const rkgwLegendData3 = ref([
  {code:"0",name:"0-30",color:"rgba(230,230,255,0.8)"},
  {code:"1",name:"30-60",color:"rgba(204,204,255,0.8)"},
  {code:"2",name:"60-100",color:"rgba(179,179,255,0.8)"},
  {code:"3",name:"100-600",color:"rgba(153,153,255,0.8)"},
  {code:"4",name:"600-1200",color:"rgba(128,128,255,0.8)"},
  {code:"5",name:"1200-1600",color:"rgba(102,102,255,0.8)"},
  {code:"6",name:"1600-5000",color:"rgba(77,77,255,0.8)"},
  {code:"7",name:"5000-15000",color:"rgba(51,51,255,0.8)"},
  {code:"8",name:"15000以上",color:"rgba(26,26,255,0.8)"},
  // {code:"0",name:"0-30",color:"rgba(0,0,255,0.1)"},
  // {code:"1",name:"30-60",color:"rgba(0,0,255,0.2)"},
  // {code:"2",name:"60-100",color:"rgba(0,0,255,0.3)"},
  // {code:"3",name:"100-600",color:"rgba(0,0,255,0.4)"},
  // {code:"4",name:"600-1200",color:"rgba(0,0,255,0.5)"},
  // {code:"5",name:"1200-1600",color:"rgba(0,0,255,0.6)"},
  // {code:"6",name:"1600-5000",color:"rgba(0,0,255,0.7)"},
  // {code:"7",name:"5000-15000",color:"rgba(0,0,255,0.8)"},
  // {code:"8",name:"15000以上",color:"rgba(0,0,255,0.9)"},
]);

const elevationLegendBool = ref(false);//是否显示高程图例
//高程图例范围
const elevationLegendData = ref([
  {code:"0",name:"0-100",color:"rgba(0,0,255,0.1)"},
  {code:"1",name:"100-300",color:"rgba(0,0,255,0.2)"},
  {code:"2",name:"300-700",color:"rgba(0,0,255,0.3)"},
  {code:"3",name:"700-1000",color:"rgba(0,0,255,0.4)"},
  {code:"4",name:"1000-1500",color:"rgba(0,0,255,0.5)"},
  {code:"5",name:"1500-2000",color:"rgba(0,0,255,0.6)"},
  {code:"6",name:"2000-2500",color:"rgba(0,0,255,0.7)"},
  {code:"7",name:"2500-3000",color:"rgba(255,0,0,0.2)"},
  {code:"8",name:"3000-3500",color:"rgba(255,0,0,0.3)"},
  {code:"9",name:"3500-4000",color:"rgba(255,0,0,0.4)"},
  {code:"10",name:"4000-4500",color:"rgba(255,0,0,0.5)"},
  {code:"11",name:"4500-5000",color:"rgba(255,0,0,0.6)"},
  {code:"12",name:"5000以上",color:"rgba(255,0,0,0.7)"},
]);

const slopeLegendBool = ref(false);//是否显示坡度图例
//坡度图例范围
const slopeLegendData = ref([
  {code:"0",name:"0-2",color:"rgba(128,246,0,0.7)"},
  {code:"1",name:"2-6",color:"rgba(255,255,0,0.7)"},
  {code:"2",name:"6-15",color:"rgba(255,203,0,0.7)"},
  {code:"3",name:"15-25",color:"rgba(255,115,0,0.7)"},
  {code:"4",name:"25-35",color:"rgb(255,80,0,0.7)"},
  {code:"5",name:"35以上",color:"rgba(255,0,0,0.7)"},
]);

const fwkznlLegendBool = ref(false);//是否显示房屋抗震能力分区图图例
//房屋抗震能力分区图图例范围
const fwkznlLegendData = ref([
  {code:"0",name:"估计抗震能力达标",color:"rgba(0,255,0,0.7)"},
  {code:"1",name:"疑似抗震能力不足",color:"rgba(255,255,0,0.7)"},
  {code:"2",name:"疑似抗震能力严重不足",color:"rgba(255,0,0,0.7)"},
]);

//地图传参--start
const completeRefreshSpaceData = ref(false);//防止刷新后地图不显示
const completeMapBool = ref(false);//是否完成加载地图
//地图对象
const map = ref(null);
const getMap = (obj)=>{
  map.value = obj;
  completeMapBool.value = true;
}
const mapClick = (event) => {
  let coordinate = map.value.getEventCoordinate(event.originalEvent);
  //根据经纬度查询所有显示图层要素信息
  queryShowLayerFeatureByLonLat(coordinate);
};
const showHideUploadDiv = (bool)=>{//显示|隐藏上传面板
  showHideUploadDivBool.value = bool;
  showHideManageDivBool.value = false;
  showHideQueryDivBool.value = false;
  queryFileResult.value = false;
  if(bool){
    showHideDivType.value = "showUploadDiv";
  }else{
    showHideDivType.value = "";
  }
  //清空上传参数
  clearUploadParams();
}
const showHideManageDiv = (bool)=>{//显示|隐藏管理面板
  showHideManageDivBool.value = bool;
  showHideUploadDivBool.value = false;
  showHideQueryDivBool.value = false;
  queryFileResult.value = false;
  if(bool){
    showHideDivType.value = "showManageDiv";
  }else{
    showHideDivType.value = "";
  }
  //清空查询参数
  clearQueryParams();
}
const showHideQueryDiv = (bool)=>{//显示|隐藏查询面板
  showHideQueryDivBool.value = bool;
  showHideUploadDivBool.value = false;
  showHideManageDivBool.value = false;
  queryFileResult.value = false;
  if(bool){
    showHideDivType.value = "showQueryDiv";
  }else{
    showHideDivType.value = "";
  }
  //清空查询参数
  clearQueryParams();
  queryMapBool.value = false;//关闭地图圈选查询
}
const showDetailId = (array)=>{//根据ID显示查询详情修改面板
  if(array!=null && array.length==2){
    let id = array[0];
    let dataType = array[1];
    //根据id查询数据
    handleDetail(id,dataType);
  }
}
//人口建筑物经济公里格网图例传参
const rkgwLegendSelectData = ref([]);

//地图圈选查询
const showQueryMapDraw = (polygonWkt)=>{
  if(polygonWkt!=null && polygonWkt!=""){
    console.log("地图圈选查询");
    console.log(polygonWkt);
    //空间统计查询参数
    chartViewQueryParams.value.province = "";
    chartViewQueryParams.value.city = "";
    chartViewQueryParams.value.county = "";
    chartViewQueryParams.value.provinceId = "";
    chartViewQueryParams.value.cityId = "";
    chartViewQueryParams.value.countyId = "";
    chartViewQueryParams.value.dataType = queryParams.value.dataType;//数据类型
    chartViewQueryParams.value.geomText = polygonWkt;//地图圈选空间数据
    let title = "【" + queryParams.value.dataType +"】";
    chartViewQueryParams.value.title = title + "地图圈选查询空间统计结果";//标题
    //显示空间统计
    chartViewQueryParams.value.showBool = true;
  }
}
//地图传参--end

//清空上传参数
function clearUploadParams(){
  uploadParams.value.province = null;
  uploadParams.value.city = null;
  uploadParams.value.county = null;
  uploadParams.value.dataType = null;
  textarea.value = "";
}

//清空查询参数
function clearQueryParams(){
  queryParams.value.province = null;
  queryParams.value.city = null;
  queryParams.value.county = null;
  queryParams.value.dataType = null;
  queryParams.value.provinceId = null;
  queryParams.value.cityId = null;
  queryParams.value.countyId = null;
  queryParams.value.fileuuid = null;//当前数据所在文件UUID
  cityData.value = [];
  areaData.value = [];
}

/** 获取省列表 */
function getProvinceData() {
  debugger;
  getProvince().then((response) => {
    console.log("省response.data");
    console.log(response.data);
    provinceData.value = response.data;
    completeRefreshSpaceData.value = true;//显示地图
    getDefaultProvice()
  });
}
//选择省
function chooseProvince(value) {
  if(showHideUploadDivBool.value){//上传面板
    uploadParams.value.city = null;
    uploadParams.value.county = null;
    uploadParams.value.province = value.name;
  }else if(showHideManageDivBool.value){//管理面板
    queryParams.value.city = null;
    queryParams.value.county = null;
    queryParams.value.province = value.name;
    queryParams.value.cityId = null;
    queryParams.value.countyId = null;
    queryParams.value.provinceId = value.id;
  }else if(showHideQueryDivBool.value){//查询面板
    queryParams.value.city = null;
    queryParams.value.county = null;
    queryParams.value.province = value.name;
    queryParams.value.cityId = null;
    queryParams.value.countyId = null;
    queryParams.value.provinceId = value.id;
    //图层查询参数
    layerDataQueryParams.value.province = value.name;
  }
  cityData.value = [];
  areaData.value = [];
  getChildArea(value.id).then(response => {
    cityData.value = response.data;
  });
}
//选择市
function chooseCity(value) {
  if(showHideUploadDivBool.value){//上传面板
    uploadParams.value.city = value.name;
    uploadParams.value.county = null;
  }else if(showHideManageDivBool.value){//管理面板
    queryParams.value.city = value.name;
    queryParams.value.county = null;
    queryParams.value.cityId = value.id;
    queryParams.value.countyId = null;
  }else if(showHideQueryDivBool.value){//查询面板
    queryParams.value.city = value.name;
    queryParams.value.county = null;
    queryParams.value.cityId = value.id;
    queryParams.value.countyId = null;
    //图层查询参数
    layerDataQueryParams.value.city = value.name;
  }
  areaData.value = [];
  getChildArea(value.id).then((response) => {
    areaData.value = response.data;
  });
}
//选择区县
function chooseCounty(value) {
  if(showHideUploadDivBool.value){//上传面板
    uploadParams.value.county = value.name;
  }else if(showHideManageDivBool.value){//管理面板
    queryParams.value.county = value.name;
    queryParams.value.countyId = value.id;
  }else if(showHideQueryDivBool.value){//查询面板
    queryParams.value.county = value.name;
    queryParams.value.countyId = value.id;
    //图层查询参数
    layerDataQueryParams.value.county = value.name;
  }
}

//警告消息
function alertMsg(msg){
  proxy.$modal.msgWarning(msg);
}

//选择文件
function uploadFileChange(){
  let uploadinputFiles = document.getElementById("spaceData-button-selectfile").files;
  minList.value = [];
  nameList.value = [];
  let text = "";
  for (let i = 0; i < uploadinputFiles.length; i++){
    console.log("uploading: " + uploadinputFiles[i].name);
    text += uploadinputFiles[i].name+"\n";
    // 获取这个文件的后缀名
    minList.value.push(uploadinputFiles[i].name.slice(uploadinputFiles[i].name.length-3,uploadinputFiles[i].name.length));
    nameList.value.push(uploadinputFiles[i].name.split(".")[0]);
  }
  textarea.value = text;
  //限制文件大小检查
  if(!limitFileSizeCheck()){
    textarea.value = "";
    document.getElementById("spaceData-button-selectfile").value = '';
    return;
  }
}

//限制文件大小检查
function limitFileSizeCheck(){
  let uploadinputFiles = document.getElementById("spaceData-button-selectfile").files;
  let dataType = uploadParams.value.dataType;//数据类型
  //不允许上传超过100M的文件
  for(let i=0;i<uploadinputFiles.length;i++){
    let size = uploadinputFiles[i].size /1024/1024;
    console.log(i+"--filesize--"+size);
    if(size >= 1024){//1G即1024M
      let msg = null;
      if(dataType=="地形地貌（高程）") {//tif文件
        msg = "网络web端传输等限制，只能支持1G以下文件的上传，建议您可以切成多个文件，按市级或区县级别分开上传。";
      }else if(dataType=="地形地貌（坡度）") {//tif文件
        msg = "网络web端传输等限制，只能支持1G以下文件的上传，并请检查坡度文件是否为90m精度栅格文件。";
      }
      if(msg!=null){
        ElMessageBox.alert(msg, '系统信息', {
          confirmButtonText: '确认',
          type: "error",
          dangerouslyUseHTMLString: true,
        });
      }
      return false;
    }
  }

  return true
}

//上传文件
function uploadFileClick(){
  let uploadinput = document.getElementById("spaceData-button-selectfile");
  if (uploadinput.value == "") {
    alertMsg("上传前请先选择文件!");
    return;
  }
  let dataType = uploadParams.value.dataType;//数据类型
  if(dataType=="地形地貌（高程）" || dataType=="地形地貌（坡度）"){//tif文件
    if(!judgeIsOnceTif(minList.value)){
      alertMsg('上传数量限制:至少.tif文件1个。');
      return;
    }else if(!judgeName(nameList.value)){
      alertMsg("文件名请保持一致！");
      return;
    }
  }else{//shp文件
    if(!judgeIsOnce(minList.value)){
      alertMsg('上传数量限制:.dbf、.prj、.shp、.shx、.cpg文件各1个;.sbn、.sbx、.shp.xml文件至多一个。');
      return;
    }else if(!judgeName(nameList.value)){
      alertMsg("文件名请保持一致！");
      return;
    }
  }
  //限制文件大小检查
  if(!limitFileSizeCheck()){
    return;
  }
  let province = uploadParams.value.province;
  let city = uploadParams.value.city;
  let area = uploadParams.value.county;
  if(province==null){
    province = "";
  }
  if(city==null){
    city = "";
  }
  if(area==null){
    area = "";
  }
  if(dataType==null){
    dataType = "";
  }
  /*if(province == ""){
    alertMsg("请选择所在省份!");
    return;
  }*/
  if(dataType=="行政区划"){
    if(province == ""){
      alertMsg("请选择所在省!");
      return;
    }
  }
  if(dataType=="房屋抗震能力分区图"){
    if(city == ""){
      alertMsg("请选择所在市!");
      return;
    }
  }
  /*if(dataType=="行政区划"){
    if(area == ""){
      alertMsg("请选择所在区县!");
      return;
    }
  }*/
  if(dataType===""){
    alertMsg("请选择数据类型!");
    return;
  }
  let formData = new FormData();
  for(let i = 0; i < uploadinput.files.length; i++){
    formData.append('files', uploadinput.files[i]);
  }
  formData.append("province", province);
  formData.append("city", city);
  formData.append("area", area);
  loading.value = true;
  //查询上传省市县的上一级和下一级文件省市县名称提示
  lookUpMapFilesByLevel({type:dataType+"_",province:province,city:city,area:area}).then((res) => {
    nextTick(() => {
      let msg = res.data;//提示
      loading.value = false;
      //上传前提示
      proxy.$modal.confirm("请确认是否要上传？"+msg).then(function () {
        loading.value = true;
        //上传
        if(dataType=="行政区划"){
          uploadAreaFiles(formData).then((response) => {
            nextTick(() => {
              let msg = response.data;
              console.log(msg);
              loading.value = false;
              if(msg.indexOf("导入成功.")!=-1) {
                if(msg.indexOf("当前数据所在文件UUID")!=-1) {
                  let fileUuid = msg.split("当前数据所在文件UUID")[1];
                  //上传文件及数据查询
                  uploadQueryClick(fileUuid);
                  msg = msg.split("当前数据所在文件UUID")[0];
                }
              }
              let messageType = "error";
              if(msg.indexOf("导入成功.")!=-1) {
                messageType = "success";
              }
              ElMessageBox.alert(msg, '系统信息', {
                confirmButtonText: '确认',
                type: messageType,
                dangerouslyUseHTMLString: true,
              });
            });
          }).catch(err => {
            loading.value = false;
          });
        }else if(dataType=="地形地貌（高程）"){
          uploadElevationFiles(formData).then((response) => {
            nextTick(() => {
              let msg = response.data;
              console.log(msg);
              loading.value = false;
              if(msg.indexOf("导入成功.")!=-1) {
                if(msg.indexOf("当前数据所在文件UUID")!=-1) {
                  let fileUuid = msg.split("当前数据所在文件UUID")[1];
                  //上传文件及数据查询
                  uploadQueryClick(fileUuid);
                  msg = msg.split("当前数据所在文件UUID")[0];
                }
              }
              let messageType = "error";
              if(msg.indexOf("导入成功.")!=-1) {
                messageType = "success";
              }
              ElMessageBox.alert(msg, '系统信息', {
                confirmButtonText: '确认',
                type: messageType,
                dangerouslyUseHTMLString: true,
              });
            });
          }).catch(err => {
            loading.value = false;
          });

        }else if(dataType=="地形地貌（坡度）"){
          uploadSlopeFiles(formData).then((response) => {
            nextTick(() => {
              let msg = response.data;
              console.log(msg);
              loading.value = false;
              if(msg.indexOf("导入成功.")!=-1) {
                if(msg.indexOf("当前数据所在文件UUID")!=-1) {
                  let fileUuid = msg.split("当前数据所在文件UUID")[1];
                  //上传文件及数据查询
                  uploadQueryClick(fileUuid);
                  msg = msg.split("当前数据所在文件UUID")[0];
                }
              }
              let messageType = "error";
              if(msg.indexOf("导入成功.")!=-1) {
                messageType = "success";
              }
              ElMessageBox.alert(msg, '系统信息', {
                confirmButtonText: '确认',
                type: messageType,
                dangerouslyUseHTMLString: true,
              });
            });
          }).catch(err => {
            loading.value = false;
          });

        }else if(dataType=="人口建筑物经济公里格网"){
          uploadPbeFiles(formData).then((response) => {
            nextTick(() => {
              let msg = response.data;
              console.log(msg);
              loading.value = false;
              if(msg.indexOf("导入成功.")!=-1) {
                if(msg.indexOf("当前数据所在文件UUID")!=-1) {
                  let fileUuid = msg.split("当前数据所在文件UUID")[1];
                  //上传文件及数据查询
                  uploadQueryClick(fileUuid);
                  msg = msg.split("当前数据所在文件UUID")[0];
                }
              }
              let messageType = "error";
              if(msg.indexOf("导入成功.")!=-1) {
                messageType = "success";
              }
              ElMessageBox.alert(msg, '系统信息', {
                confirmButtonText: '确认',
                type: messageType,
                dangerouslyUseHTMLString: true,
              });
            });
          }).catch(err => {
            loading.value = false;
          });

        }else if(dataType=="交通（道路）"){
          uploadRoadFiles(formData).then((response) => {
            nextTick(() => {
              let msg = response.data;
              console.log(msg);
              loading.value = false;
              if(msg.indexOf("导入成功.")!=-1) {
                if(msg.indexOf("当前数据所在文件UUID")!=-1) {
                  let fileUuid = msg.split("当前数据所在文件UUID")[1];
                  //上传文件及数据查询
                  uploadQueryClick(fileUuid);
                  msg = msg.split("当前数据所在文件UUID")[0];
                }
              }
              let messageType = "error";
              if(msg.indexOf("导入成功.")!=-1) {
                messageType = "success";
              }
              ElMessageBox.alert(msg, '系统信息', {
                confirmButtonText: '确认',
                type: messageType,
                dangerouslyUseHTMLString: true,
              });
            });
          }).catch(err => {
            loading.value = false;
          });

        }else if(dataType=="交通（机场）"){
          uploadAirportFiles(formData).then((response) => {
            nextTick(() => {
              let msg = response.data;
              console.log(msg);
              loading.value = false;
              if(msg.indexOf("导入成功.")!=-1) {
                if(msg.indexOf("当前数据所在文件UUID")!=-1) {
                  let fileUuid = msg.split("当前数据所在文件UUID")[1];
                  //上传文件及数据查询
                  uploadQueryClick(fileUuid);
                  msg = msg.split("当前数据所在文件UUID")[0];
                }
              }
              let messageType = "error";
              if(msg.indexOf("导入成功.")!=-1) {
                messageType = "success";
              }
              ElMessageBox.alert(msg, '系统信息', {
                confirmButtonText: '确认',
                type: messageType,
                dangerouslyUseHTMLString: true,
              });
            });
          }).catch(err => {
            loading.value = false;
          });

        }else if(dataType=="水库"){
          uploadReservoirFiles(formData).then((response) => {
            nextTick(() => {
              let msg = response.data;
              console.log(msg);
              loading.value = false;
              if(msg.indexOf("导入成功.")!=-1) {
                if(msg.indexOf("当前数据所在文件UUID")!=-1) {
                  let fileUuid = msg.split("当前数据所在文件UUID")[1];
                  //上传文件及数据查询
                  uploadQueryClick(fileUuid);
                  msg = msg.split("当前数据所在文件UUID")[0];
                }
              }
              let messageType = "error";
              if(msg.indexOf("导入成功.")!=-1) {
                messageType = "success";
              }
              ElMessageBox.alert(msg, '系统信息', {
                confirmButtonText: '确认',
                type: messageType,
                dangerouslyUseHTMLString: true,
              });
            });
          }).catch(err => {
            loading.value = false;
          });

        }else if(dataType=="学校"){
          uploadSchoolFiles(formData).then((response) => {
            nextTick(() => {
              let msg = response.data;
              console.log(msg);
              loading.value = false;
              if(msg.indexOf("导入成功.")!=-1) {
                if(msg.indexOf("当前数据所在文件UUID")!=-1) {
                  let fileUuid = msg.split("当前数据所在文件UUID")[1];
                  //上传文件及数据查询
                  uploadQueryClick(fileUuid);
                  msg = msg.split("当前数据所在文件UUID")[0];
                }
              }
              let messageType = "error";
              if(msg.indexOf("导入成功.")!=-1) {
                messageType = "success";
              }
              ElMessageBox.alert(msg, '系统信息', {
                confirmButtonText: '确认',
                type: messageType,
                dangerouslyUseHTMLString: true,
              });
            });
          }).catch(err => {
            loading.value = false;
          });

        }else if(dataType=="地质灾害"){
          uploadGeologicalFiles(formData).then((response) => {
            nextTick(() => {
              let msg = response.data;
              console.log(msg);
              loading.value = false;
              if(msg.indexOf("导入成功.")!=-1) {
                if(msg.indexOf("当前数据所在文件UUID")!=-1) {
                  let fileUuid = msg.split("当前数据所在文件UUID")[1];
                  //上传文件及数据查询
                  uploadQueryClick(fileUuid);
                  msg = msg.split("当前数据所在文件UUID")[0];
                }
              }
              let messageType = "error";
              if(msg.indexOf("导入成功.")!=-1) {
                messageType = "success";
              }
              ElMessageBox.alert(msg, '系统信息', {
                confirmButtonText: '确认',
                type: messageType,
                dangerouslyUseHTMLString: true,
              });
            });
          }).catch(err => {
            loading.value = false;
          });

        }else if(dataType=="断层"){
          uploadFaultageFiles(formData).then((response) => {
            nextTick(() => {
              let msg = response.data;
              console.log(msg);
              loading.value = false;
              if(msg.indexOf("导入成功.")!=-1) {
                if(msg.indexOf("当前数据所在文件UUID")!=-1) {
                  let fileUuid = msg.split("当前数据所在文件UUID")[1];
                  //上传文件及数据查询
                  uploadQueryClick(fileUuid);
                  msg = msg.split("当前数据所在文件UUID")[0];
                }
              }
              let messageType = "error";
              if(msg.indexOf("导入成功.")!=-1) {
                messageType = "success";
              }
              ElMessageBox.alert(msg, '系统信息', {
                confirmButtonText: '确认',
                type: messageType,
                dangerouslyUseHTMLString: true,
              });
            });
          }).catch(err => {
            loading.value = false;
          });

        }else if(dataType=="次生灾害危险源（危化企业）"){
          uploadRiskEnterpriseFiles(formData).then((response) => {
            nextTick(() => {
              let msg = response.data;
              console.log(msg);
              loading.value = false;
              if(msg.indexOf("导入成功.")!=-1) {
                if(msg.indexOf("当前数据所在文件UUID")!=-1) {
                  let fileUuid = msg.split("当前数据所在文件UUID")[1];
                  //上传文件及数据查询
                  uploadQueryClick(fileUuid);
                  msg = msg.split("当前数据所在文件UUID")[0];
                }
              }
              let messageType = "error";
              if(msg.indexOf("导入成功.")!=-1) {
                messageType = "success";
              }
              ElMessageBox.alert(msg, '系统信息', {
                confirmButtonText: '确认',
                type: messageType,
                dangerouslyUseHTMLString: true,
              });
            });
          }).catch(err => {
            loading.value = false;
          });

        }else if(dataType=="次生灾害危险源（加油站）"){
          uploadGasstationFiles(formData).then((response) => {
            nextTick(() => {
              let msg = response.data;
              console.log(msg);
              loading.value = false;
              if(msg.indexOf("导入成功.")!=-1) {
                if(msg.indexOf("当前数据所在文件UUID")!=-1) {
                  let fileUuid = msg.split("当前数据所在文件UUID")[1];
                  //上传文件及数据查询
                  uploadQueryClick(fileUuid);
                  msg = msg.split("当前数据所在文件UUID")[0];
                }
              }
              let messageType = "error";
              if(msg.indexOf("导入成功.")!=-1) {
                messageType = "success";
              }
              ElMessageBox.alert(msg, '系统信息', {
                confirmButtonText: '确认',
                type: messageType,
                dangerouslyUseHTMLString: true,
              });
            });
          }).catch(err => {
            loading.value = false;
          });

        }else if(dataType=="应急避难场所"){
          uploadEmergencyShelterFiles(formData).then((response) => {
            nextTick(() => {
              let msg = response.data;
              console.log(msg);
              loading.value = false;
              if(msg.indexOf("导入成功.")!=-1) {
                if(msg.indexOf("当前数据所在文件UUID")!=-1) {
                  let fileUuid = msg.split("当前数据所在文件UUID")[1];
                  //上传文件及数据查询
                  uploadQueryClick(fileUuid);
                  msg = msg.split("当前数据所在文件UUID")[0];
                }
              }
              let messageType = "error";
              if(msg.indexOf("导入成功.")!=-1) {
                messageType = "success";
              }
              ElMessageBox.alert(msg, '系统信息', {
                confirmButtonText: '确认',
                type: messageType,
                dangerouslyUseHTMLString: true,
              });
            });
          }).catch(err => {
            loading.value = false;
          });

        }else if(dataType=="医院"){
          uploadHospitalFiles(formData).then((response) => {
            nextTick(() => {
              let msg = response.data;
              console.log(msg);
              loading.value = false;
              if(msg.indexOf("导入成功.")!=-1) {
                if(msg.indexOf("当前数据所在文件UUID")!=-1) {
                  let fileUuid = msg.split("当前数据所在文件UUID")[1];
                  //上传文件及数据查询
                  uploadQueryClick(fileUuid);
                  msg = msg.split("当前数据所在文件UUID")[0];
                }
              }
              let messageType = "error";
              if(msg.indexOf("导入成功.")!=-1) {
                messageType = "success";
              }
              ElMessageBox.alert(msg, '系统信息', {
                confirmButtonText: '确认',
                type: messageType,
                dangerouslyUseHTMLString: true,
              });
            });
          }).catch(err => {
            loading.value = false;
          });

        }else if(dataType=="房屋抗震能力分区图"){
          uploadKangZhenTuFiles(formData).then((response) => {
            nextTick(() => {
              let msg = response.data;
              console.log(msg);
              loading.value = false;
              if(msg.indexOf("导入成功.")!=-1) {
                if(msg.indexOf("当前数据所在文件UUID")!=-1) {
                  let fileUuid = msg.split("当前数据所在文件UUID")[1];
                  //上传文件及数据查询
                  uploadQueryClick(fileUuid);
                  msg = msg.split("当前数据所在文件UUID")[0];
                }
              }
              let messageType = "error";
              if(msg.indexOf("导入成功.")!=-1) {
                messageType = "success";
              }
              ElMessageBox.alert(msg, '系统信息', {
                confirmButtonText: '确认',
                type: messageType,
                dangerouslyUseHTMLString: true,
              });
            });
          }).catch(err => {
            loading.value = false;
          });

        }
      }).catch(() => {
        loading.value = false;
      });
    });
  });
}

//校验shp文件类型
function judgeIsOnce(list) {
  // ["dbf","prj","shp","shx","cpg"];
  let dbf = 0,prj = 0,shp = 0,shx = 0,cpg = 0,sbn = 0,sbx = 0,xml = 0;
  for(let i=0;i<list.length;i++){
    let item = list[i];
    if(item == 'dbf') dbf++;
    if(item == 'prj') prj++;
    if(item == 'shp') shp++;
    if(item == 'shx') shx++;
    if(item == 'cpg') cpg++;
    if(item == 'sbn') sbn++;
    if(item == 'sbx') sbx++;
    if(item == 'xml') xml++;
  }
  if(dbf == 1 && prj == 1 && shp == 1 && shx == 1 && cpg == 1 && sbn < 2 && sbx < 2 && xml < 2) return true;
  else return false;
}
//校验shp文件名称
function judgeName(list) {
  let name = list[0];
  let result = list.filter(function (item) {
    return item == name;
  })
  if(result.length == list.length) return true;
  else return false;
}

//校验tif文件类型
function judgeIsOnceTif(list) {
  let tif = 0;
  for(let i=0;i<list.length;i++){
    let item = list[i];
    if(item == 'tif') tif++;
  }
  if(tif == 1) return true;
  else return false;
}

//文件查询
function fileQuery(){
  //查询数据类型
  let dataType = queryParams.value.dataType;
  if(showHideManageDivBool.value || dataType=='地形地貌（高程）' || dataType=='地形地貌（坡度）') {//管理面板、查询面板tif文件查询
    getAllFile(queryParams.value).then((response) => {
      nextTick(() => {
        console.log(response.data);
        let list = response.data.rows;
        fileDataList.value = response.data.rows;
        //关闭查看详情面板
        closeDetailResultDiv();
        if(showHideManageDivBool.value){//管理面板
          //是否显示查询文件结果面板
          queryFileResult.value = true;
        }
        //查询高程、坡度
        if(dataType=='地形地貌（高程）' || dataType=='地形地貌（坡度）'){
          //获取超图tif文件图层
          getSuperMapTifLayer(list);
        }
      });
    });
  }
}

//上传文件及数据查询
function uploadQueryClick(fileuuid){
  queryParams.value.province = uploadParams.value.province;
  queryParams.value.city = uploadParams.value.city;
  queryParams.value.county = uploadParams.value.county;
  queryParams.value.dataType = uploadParams.value.dataType;
  queryParams.value.fileuuid = fileuuid;//当前数据所在文件UUID
  //文件及数据查询
  queryClick();
  /*let provinceList = provinceData.value;
  for(let i=0;i<provinceList.length;i++){
    let province = provinceList[i];
    if(province.name==uploadParams.value.province){
      queryParams.value.provinceId = province.id;
      getChildArea(province.id).then(response => {
        let cityList = response.data;
        let cityId = null;
        let countyId = null;
        for(let j=0;j<cityList.length;j++){
          let city = cityList[j];
          if(city.name==uploadParams.value.city){
            cityId = city.id;
            queryParams.value.cityId = city.id;
            getChildArea(city.id).then(response => {
              let countyList = response.data;
              for(let k=0;k<countyList.length;k++){
                let county = countyList[k];
                if(county.name==uploadParams.value.county){
                  //有省市区县
                  countyId = county.id;
                  queryParams.value.countyId = county.id;
                  //文件及数据查询
                  queryClick();
                  break;
                }
              }
              if(countyId==null){//只有省市
                queryParams.value.cityId = cityId;
                queryParams.value.countyId = countyId;
                //文件及数据查询
                queryClick();
              }
            });
          }
        }
        if(cityId==null){//只有省
          queryParams.value.cityId = cityId;
          queryParams.value.countyId = countyId;
          //文件及数据查询
          queryClick();
        }
      });
    }
  }*/
}

//文件及数据查询
function queryClick(){
  //查询数据类型
  queryDataType.value = queryParams.value.dataType;
  let dataType = queryDataType.value;
  if(dataType==null){
    dataType = "";
  }
  if(dataType===""){
    alertMsg("请选择数据类型!");
    return;
  }
  //数据查询
  loading.value = true;
  //查询高程、坡度
  if(dataType=='地形地貌（高程）' || dataType=='地形地貌（坡度）'){
    //查询前移除超图tif文件图层
    removeSuperMapTifLayer(dataType);
  }
  //文件查询
  fileQuery();
  //查询统计
  if(!(dataType=='行政区划' || dataType=='地形地貌（高程）' || dataType=='交通（道路）') && showHideQueryDivBool.value==true){
    //开启空间统计查询功能
    queryChartsView();
  }
  console.log(dataType);
  //省级数据查询
  if(dataType=="行政区划"){
    xzqhLayerBool.value = true;//图层显示
    console.log(dataType);
    //查询
    getAllAreaData(queryParams.value).then((response) => {
      nextTick(() => {
        console.log(response.data);
        xzqhAllData.value = response.data.rows;
        //关闭查看详情面板
        closeDetailResultDiv();
        loading.value = false;
      });
    }).catch(err => {
      loading.value = false;
    });
  }else if(dataType=="地形地貌（高程）"){
    dxdmGcLayerBool.value = true;//图层显示
    console.log(dataType);
    loading.value = false;
    //查询
    /*getAllElevationData(queryParams.value).then((response) => {
      nextTick(() => {
        console.log(response.data);
        dxdmGcAllData.value = response.data.rows;
        //关闭查看详情面板
        closeDetailResultDiv();
        loading.value = false;
      });
    }).catch(err => {
      loading.value = false;
    });*/
  }else if(dataType=="地形地貌（坡度）"){
    dxdmPdLayerBool.value = true;//图层显示
    console.log(dataType);
    loading.value = false;
    //查询
    /*getAllSlopeData(queryParams.value).then((response) => {
      nextTick(() => {
        console.log(response.data);
        dxdmPdAllData.value = response.data.rows;
        //关闭查看详情面板
        closeDetailResultDiv();
        loading.value = false;
      });
    }).catch(err => {
      loading.value = false;
    });*/
  }else if(dataType=="人口建筑物经济公里格网"){
    rkgwLayerBool.value = true;//图层显示
    console.log(dataType);
    //查询
    getAllPbeData(queryParams.value).then((response) => {
      nextTick(() => {
        console.log(response.data);
        rkgwAllData.value = response.data.rows;
        //关闭查看详情面板
        closeDetailResultDiv();
        loading.value = false;
      });
    }).catch(err => {
      loading.value = false;
    });
  }else if(dataType=="交通（道路）"){
    jtDlLayerBool.value = true;//图层显示
    console.log(dataType);
    //查询
    getAllRoadData(queryParams.value).then((response) => {
      nextTick(() => {
        console.log(response.data);
        jtDlAllData.value = response.data.rows;
        //关闭查看详情面板
        closeDetailResultDiv();
        loading.value = false;
      });
    }).catch(err => {
      loading.value = false;
    });
  }else if(dataType=="交通（机场）"){
    jtJcLayerBool.value = true;//图层显示
    console.log(dataType);
    //查询
    getAllAirportData(queryParams.value).then((response) => {
      nextTick(() => {
        console.log(response.data);
        jtJcAllData.value = response.data.rows;
        //关闭查看详情面板
        closeDetailResultDiv();
        loading.value = false;
      });
    }).catch(err => {
      loading.value = false;
    });
  }else if(dataType=="水库"){
    skLayerBool.value = true;//图层显示
    console.log(dataType);
    //查询
    getAllReservoirData(queryParams.value).then((response) => {
      nextTick(() => {
        console.log(response.data);
        skAllData.value = response.data.rows;
        //关闭查看详情面板
        closeDetailResultDiv();
        loading.value = false;
      });
    }).catch(err => {
      loading.value = false;
    });
  }else if(dataType=="学校"){
    schoolLayerBool.value = true;//图层显示
    console.log(dataType);
    //查询
    getAllSchoolData(queryParams.value).then((response) => {
      nextTick(() => {
        console.log(response.data);
        schoolAllData.value = response.data.rows;
        //关闭查看详情面板
        closeDetailResultDiv();
        loading.value = false;
      });
    }).catch(err => {
      loading.value = false;
    });
  }else if(dataType=="地质灾害"){
    dzzhLayerBool.value = true;//图层显示
    console.log(dataType);
    //查询
    getAllGeologicalData(queryParams.value).then((response) => {
      nextTick(() => {
        console.log(response.data);
        dzzhAllData.value = response.data.rows;
        //关闭查看详情面板
        closeDetailResultDiv();
        loading.value = false;
      });
    }).catch(err => {
      loading.value = false;
    });
  }else if(dataType=="断层"){
    dcLayerBool.value = true;//图层显示
    console.log(dataType);
    //查询
    getAllFaultageData(queryParams.value).then((response) => {
      nextTick(() => {
        console.log(response.data);
        dcAllData.value = response.data.rows;
        //关闭查看详情面板
        closeDetailResultDiv();
        loading.value = false;
      });
    }).catch(err => {
      loading.value = false;
    });
  }else if(dataType=="次生灾害危险源（危化企业）"){
    csWhqyLayerBool.value = true;//图层显示
    console.log(dataType);
    //查询
    getAllRiskEnterpriseData(queryParams.value).then((response) => {
      nextTick(() => {
        console.log(response.data);
        csWhqyAllData.value = response.data.rows;
        //关闭查看详情面板
        closeDetailResultDiv();
        loading.value = false;
      });
    }).catch(err => {
      loading.value = false;
    });
  }else if(dataType=="次生灾害危险源（加油站）"){
    csJyzLayerBool.value = true;//图层显示
    console.log(dataType);
    //查询
    getAllGasstationData(queryParams.value).then((response) => {
      nextTick(() => {
        console.log(response.data);
        csJyzAllData.value = response.data.rows;
        //关闭查看详情面板
        closeDetailResultDiv();
        loading.value = false;
      });
    }).catch(err => {
      loading.value = false;
    });
  }else if(dataType=="应急避难场所"){
    yjbncsLayerBool.value = true;//图层显示
    console.log(dataType);
    //查询
    getAllEmergencyShelterData(queryParams.value).then((response) => {
      nextTick(() => {
        console.log(response.data);
        yjbncsAllData.value = response.data.rows;
        //关闭查看详情面板
        closeDetailResultDiv();
        loading.value = false;
      });
    }).catch(err => {
      loading.value = false;
    });
  }else if(dataType=="医院"){
    hospitalLayerBool.value = true;//图层显示
    console.log(dataType);
    //查询
    getAllHospitalData(queryParams.value).then((response) => {
      nextTick(() => {
        console.log(response.data);
        hospitalAllData.value = response.data.rows;
        //关闭查看详情面板
        closeDetailResultDiv();
        loading.value = false;
      });
    }).catch(err => {
      loading.value = false;
    });
  }else if(dataType=="房屋抗震能力分区图"){
    fwkznlLayerBool.value = true;//图层显示
    console.log(dataType);
    //查询
    getAllKangZhenTuData(queryParams.value).then((response) => {
      nextTick(() => {
        console.log(response.data);
        fwkznlAllData.value = response.data.rows;
        //关闭查看详情面板
        closeDetailResultDiv();
        loading.value = false;
      });
    }).catch(err => {
      loading.value = false;
    });
  }
}

//获取超图tif文件图层
function getSuperMapTifLayer(list){
  console.log(list);
  for(let i=0;i<list.length;i++){
    let fileName = list[i].affiliatedFileName;
    let type = list[i].type;
    if(type=="地形地貌（高程）_" || type=="地形地貌（坡度）_"){
      let dataTypeInfo = getDataTypeInfo(type.split("_")[0]);
      if(dataTypeInfo) {
        let url = dataTypeInfo.url + fileName;
        let layerId = dataTypeInfo.code + fileName;
        let zIndex = dataTypeInfo.zIndex;
        //添加超图临时图层
        getGridLayer(url).then((layer) => {
          layer.set('id', layerId);
          layer.setZIndex(zIndex);
          map.value.addLayer(layer);
          loading.value = false;
        }).catch(() => {
          loading.value = false;
        });
      }
    }
  }
}

//查询前移除超图tif文件图层
function removeSuperMapTifLayer(dataType){
  let dataTypeInfo = getDataTypeInfo(dataType);
  if(dataTypeInfo) {
    let layerId = dataTypeInfo.code;
    //是否已有图层并移除图层
    removeLayerBool(layerId);
  }
}

//查询图层数据
function queryLayerData(dataType){
  loading.value = true;
  layerDataQueryParams.value.dataType = dataType;//数据类型
  if(layerRadio.value=="1"){//国家级数据
    loading.value = false;
    if(dataType=="行政区划"){
      //清空图层数据
      xzqhAllData.value = [];
    }else if(dataType=="地形地貌（高程）"){//地形地貌（高程）
      //清空图层数据
      dxdmGcAllData.value = [];
    }else if(dataType=="地形地貌（坡度）"){//地形地貌（坡度）
      //清空图层数据
      dxdmPdAllData.value = [];
    }else if(dataType=="人口建筑物经济公里格网"){
      //清空图层数据
      rkgwAllData.value = [];
    }else if(dataType=="交通（道路）"){//交通（道路）
      //清空图层数据
      jtDlAllData.value = [];
    }else if(dataType=="交通（机场）"){//交通（机场）
      //清空图层数据
      jtJcAllData.value = [];
    }else if(dataType=="水库"){
      //清空图层数据
      skAllData.value = [];
    }else if(dataType=="学校"){
      //清空图层数据
      schoolAllData.value = [];
    }else if(dataType=="地质灾害"){
      //清空图层数据
      dzzhAllData.value = [];
    }else if(dataType=="断层"){
      //清空图层数据
      dcAllData.value = [];
    }else if(dataType=="次生灾害危险源（危化企业）"){//次生灾害危险源（危化企业）
      //清空图层数据
      csWhqyAllData.value = [];
    }else if(dataType=="次生灾害危险源（加油站）"){//次生灾害危险源（加油站）
      //清空图层数据
      csJyzAllData.value = [];
    }else if(dataType=="应急避难场所"){
      //清空图层数据
      yjbncsAllData.value = [];
    }else if(dataType=="医院"){
      //清空图层数据
      hospitalAllData.value = [];
    }else if(dataType=="房屋抗震能力分区图"){
      //清空图层数据
      fwkznlAllData.value = [];
    }
  }else if(layerRadio.value=="2") {//省级数据
    /*if(dataType=="行政区划"){
      console.log(dataType);
      getAllAreaData(layerDataQueryParams.value).then((response) => {
        nextTick(() => {
          console.log(response.data);
          xzqhAllData.value = response.data.rows;
          //关闭查看详情面板
          closeDetailResultDiv();
          loading.value = false;
        }).catch(err => {
          loading.value = false;
        });
      });
    }else if(dataType=="地形地貌（高程）"){//地形地貌（高程）
      console.log(dataType);
      getAllElevationData(layerDataQueryParams.value).then((response) => {
        nextTick(() => {
          console.log(response.data);
          dxdmGcAllData.value = response.data.rows;
          //关闭查看详情面板
          closeDetailResultDiv();
          loading.value = false;
        });
      }).catch(err => {
        loading.value = false;
      });
    }else if(dataType=="地形地貌（坡度）"){//地形地貌（坡度）
      console.log(dataType);
      getAllSlopeData(layerDataQueryParams.value).then((response) => {
        nextTick(() => {
          console.log(response.data);
          dxdmPdAllData.value = response.data.rows;
          //关闭查看详情面板
          closeDetailResultDiv();
          loading.value = false;
        });
      }).catch(err => {
        loading.value = false;
      });
    }else if(dataType=="人口建筑物经济公里格网"){
      console.log(dataType);
      getAllPbeData(layerDataQueryParams.value).then((response) => {
        nextTick(() => {
          console.log(response.data);
          rkgwAllData.value = response.data.rows;
          //关闭查看详情面板
          closeDetailResultDiv();
          loading.value = false;
        });
      }).catch(err => {
        loading.value = false;
      });
    }else if(dataType=="交通（道路）"){//交通（道路）
      console.log(dataType);
      getAllRoadData(layerDataQueryParams.value).then((response) => {
        nextTick(() => {
          console.log(response.data);
          jtDlAllData.value = response.data.rows;
          //关闭查看详情面板
          closeDetailResultDiv();
          loading.value = false;
        });
      }).catch(err => {
        loading.value = false;
      });
    }else if(dataType=="交通（机场）"){//交通（机场）
      console.log(dataType);
      getAllAirportData(layerDataQueryParams.value).then((response) => {
        nextTick(() => {
          console.log(response.data);
          jtJcAllData.value = response.data.rows;
          //关闭查看详情面板
          closeDetailResultDiv();
          loading.value = false;
        });
      }).catch(err => {
        loading.value = false;
      });
    }else if(dataType=="水库"){
      console.log(dataType);
      getAllReservoirData(layerDataQueryParams.value).then((response) => {
        nextTick(() => {
          console.log(response.data);
          skAllData.value = response.data.rows;
          //关闭查看详情面板
          closeDetailResultDiv();
          loading.value = false;
        });
      }).catch(err => {
        loading.value = false;
      });
    }else if(dataType=="学校"){
      console.log(dataType);
      getAllSchoolData(layerDataQueryParams.value).then((response) => {
        nextTick(() => {
          console.log(response.data);
          schoolAllData.value = response.data.rows;
          //关闭查看详情面板
          closeDetailResultDiv();
          loading.value = false;
        });
      }).catch(err => {
        loading.value = false;
      });
    }else if(dataType=="地质灾害"){
      console.log(dataType);
      getAllGeologicalData(layerDataQueryParams.value).then((response) => {
        nextTick(() => {
          console.log(response.data);
          dzzhAllData.value = response.data.rows;
          //关闭查看详情面板
          closeDetailResultDiv();
          loading.value = false;
        });
      }).catch(err => {
        loading.value = false;
      });
    }else if(dataType=="断层"){
      console.log(dataType);
      getAllFaultageData(layerDataQueryParams.value).then((response) => {
        nextTick(() => {
          console.log(response.data);
          dcAllData.value = response.data.rows;
          //关闭查看详情面板
          closeDetailResultDiv();
          loading.value = false;
        });
      }).catch(err => {
        loading.value = false;
      });
    }else if(dataType=="次生灾害危险源（危化企业）"){//次生灾害危险源（危化企业）
      console.log(dataType);
      getAllRiskEnterpriseData(layerDataQueryParams.value).then((response) => {
        nextTick(() => {
          console.log(response.data);
          csWhqyAllData.value = response.data.rows;
          //关闭查看详情面板
          closeDetailResultDiv();
          loading.value = false;
        });
      }).catch(err => {
        loading.value = false;
      });
    }else if(dataType=="次生灾害危险源（加油站）"){//次生灾害危险源（加油站）
      console.log(dataType);
      getAllGasstationData(layerDataQueryParams.value).then((response) => {
        nextTick(() => {
          console.log(response.data);
          csJyzAllData.value = response.data.rows;
          //关闭查看详情面板
          closeDetailResultDiv();
          loading.value = false;
        });
      }).catch(err => {
        loading.value = false;
      });
    }else if(dataType=="应急避难场所"){
      console.log(dataType);
      getAllEmergencyShelterData(layerDataQueryParams.value).then((response) => {
        nextTick(() => {
          console.log(response.data);
          yjbncsAllData.value = response.data.rows;
          //关闭查看详情面板
          closeDetailResultDiv();
          loading.value = false;
        });
      }).catch(err => {
        loading.value = false;
      });
    }else if(dataType=="医院"){
      console.log(dataType);
      getAllHospitalData(layerDataQueryParams.value).then((response) => {
        nextTick(() => {
          console.log(response.data);
          hospitalAllData.value = response.data.rows;
          //关闭查看详情面板
          closeDetailResultDiv();
          loading.value = false;
        });
      }).catch(err => {
        loading.value = false;
      });
    }else if(dataType=="房屋抗震能力分区图"){
      console.log(dataType);
      getAllKangZhenTuData(layerDataQueryParams.value).then((response) => {
        nextTick(() => {
          console.log(response.data);
          fwkznlAllData.value = response.data.rows;
          //关闭查看详情面板
          closeDetailResultDiv();
          loading.value = false;
        });
      }).catch(err => {
        loading.value = false;
      });
    }*/
    //关闭查看详情面板
    closeDetailResultDiv();
    //显示超图图层
    showRestLayerByType(dataType,true);
  }
}

//关闭查询文件结果面板
function closeQueryFileResult(){
  queryFileResult.value = false;
}

//删除文件数据
function deleteFileResultClick(){
  let ids = "";
  let selectRows = multipleSelection.value;
  if(selectRows!=null && selectRows.length>0){
    if(selectRows.length>10){
      alertMsg("最多勾选10条数据进行删除!");
      return;
    }
    for(let i=0;i<selectRows.length;i++){
      if(ids!=""){
        ids += ",";
      }
      ids += selectRows[i].uuid;
    }
    //删除事件
    deleteEvent(ids);
  }else{
    alertMsg("请勾选1条数据进行删除!");
  }
}

//删除事件
function deleteEvent(ids){
  let dataType = queryDataType.value;
  if(ids!="") {
    console.log(ids);
    proxy.$modal
        .confirm("请确认是否要删除？",)
        .then(function () {
          loading.value = true;
          //数据类型
          if(dataType=="行政区划"){
            return delAreaFileData(ids);

          }else if(dataType=="地形地貌（高程）"){//地形地貌（高程）
            return delElevationFileData(ids);

          }else if(dataType=="地形地貌（坡度）"){//地形地貌（坡度）
            return delSlopeFileData(ids);

          }else if(dataType=="人口建筑物经济公里格网"){
            return delPbeFileData(ids);

          }else if(dataType=="交通（道路）"){//交通（道路）
            return delRoadFileData(ids);

          }else if(dataType=="交通（机场）"){//交通（机场）
            return delAirportFileData(ids);

          }else if(dataType=="水库"){
            return delReservoirFileData(ids);

          }else if(dataType=="学校"){
            return delSchoolFileData(ids);

          }else if(dataType=="地质灾害"){
            return delGeologicalFileData(ids);

          }else if(dataType=="断层"){
            return delFaultageFileData(ids);

          }else if(dataType=="次生灾害危险源（危化企业）"){//次生灾害危险源（危化企业）
            return delRiskEnterpriseFileData(ids);

          }else if(dataType=="次生灾害危险源（加油站）"){//次生灾害危险源（加油站）
            return delGasstationFileData(ids);

          }else if(dataType=="应急避难场所"){
            return delEmergencyShelterFileData(ids);

          }else if(dataType=="医院"){
            return delHospitalFileData(ids);

          }else if(dataType=="房屋抗震能力分区图"){
            return delKangZhenTuFileData(ids);

          }
        })
        .then(() => {
          loading.value = false;
          //关闭查看详情面板
          closeDetailResultDiv();
          //关闭查询文件结果面板
          closeQueryFileResult();
          //查询图层数据
          // queryLayerData(dataType);
          proxy.$modal.msgSuccess("删除成功");
        })
        .catch(() => {
          loading.value = false;
        });
  }
}

//下载文件数据
function downloadFileResultClick(){
  let selectRows = multipleSelection.value;
  if(selectRows!=null && selectRows.length>0){
    if(selectRows.length>1){
      alertMsg("请勾选1条数据进行下载!");
      return;
    }
    //文件名
    let affiliatedFileName = selectRows[0].affiliatedFileName;
    manageFileParams.value.affiliatedFileName = affiliatedFileName;//文件名
    //下载文件
    let fileName = affiliatedFileName + ".zip";
    proxy.download("/fxfzypg/baseData/downloadSpaceFile", {
      ...manageFileParams.value
    }, fileName);
  }else{
    alertMsg("请勾选1条数据进行下载!");
  }
}

//查询结果多选事件
function handleSelectionChange(val) {
  multipleSelection.value = val;
  console.log(val);
}

//根据id查询数据
function handleDetail(id,dataType){
  console.log(id);
  selectId.value = id;//选中查看详情数据Id
  selectType.value = dataType;//选中查看详情数据类型
  selectDataResult.value = null;//清空
  //选中查看详情数据
  if(dataType=="行政区划"){
    getAreaDataById(id).then((response) => {
      nextTick(() => {
        console.log(response.data);
        selectDataResult.value = response.data.rows;
        console.log("选中查看详情数据");
        console.log(selectDataResult.value);
        detailTable.value = true;//打开下方查看详情面板
      });
    });
  }else if(dataType=="地形地貌（高程）"){//地形地貌（高程）


  }else if(dataType=="地形地貌（坡度）"){//地形地貌（坡度）


  }else if(dataType=="人口建筑物经济公里格网"){
    getPbeDataById(id).then((response) => {
      nextTick(() => {
        console.log(response.data);
        selectDataResult.value = response.data.rows;
        console.log("选中查看详情数据");
        console.log(selectDataResult.value);
        detailTable.value = true;//打开下方查看详情面板
      });
    });

  }else if(dataType=="交通（道路）"){//交通（道路）
    getRoadDataById(id).then((response) => {
      nextTick(() => {
        console.log(response.data);
        selectDataResult.value = response.data.rows;
        console.log("选中查看详情数据");
        console.log(selectDataResult.value);
        detailTable.value = true;//打开下方查看详情面板
      });
    });

  }else if(dataType=="交通（机场）"){//交通（机场）
    getAirportDataById(id).then((response) => {
      nextTick(() => {
        console.log(response.data);
        selectDataResult.value = response.data.rows;
        console.log("选中查看详情数据");
        console.log(selectDataResult.value);
        detailTable.value = true;//打开下方查看详情面板
      });
    });

  }else if(dataType=="水库"){
    getReservoirDataById(id).then((response) => {
      nextTick(() => {
        console.log(response.data);
        selectDataResult.value = response.data.rows;
        console.log("选中查看详情数据");
        console.log(selectDataResult.value);
        detailTable.value = true;//打开下方查看详情面板
      });
    });


  }else if(dataType=="学校"){
    getSchoolDataById(id).then((response) => {
      nextTick(() => {
        console.log(response.data);
        selectDataResult.value = response.data.rows;
        console.log("选中查看详情数据");
        console.log(selectDataResult.value);
        detailTable.value = true;//打开下方查看详情面板
      });
    });

  }else if(dataType=="地质灾害"){
    getGeologicalDataById(id).then((response) => {
      nextTick(() => {
        console.log(response.data);
        selectDataResult.value = response.data.rows;
        console.log("选中查看详情数据");
        console.log(selectDataResult.value);
        detailTable.value = true;//打开下方查看详情面板
      });
    });

  }else if(dataType=="断层"){
    getFaultageDataById(id).then((response) => {
      nextTick(() => {
        console.log(response.data);
        selectDataResult.value = response.data.rows;
        console.log("选中查看详情数据");
        console.log(selectDataResult.value);
        detailTable.value = true;//打开下方查看详情面板
      });
    });

  }else if(dataType=="次生灾害危险源（危化企业）"){//次生灾害危险源（危化企业）
    getRiskEnterpriseDataById(id).then((response) => {
      nextTick(() => {
        console.log(response.data);
        selectDataResult.value = response.data.rows;
        console.log("选中查看详情数据");
        console.log(selectDataResult.value);
        detailTable.value = true;//打开下方查看详情面板
      });
    });

  }else if(dataType=="次生灾害危险源（加油站）"){//次生灾害危险源（加油站）
    getGasstationDataById(id).then((response) => {
      nextTick(() => {
        console.log(response.data);
        selectDataResult.value = response.data.rows;
        console.log("选中查看详情数据");
        console.log(selectDataResult.value);
        detailTable.value = true;//打开下方查看详情面板
      });
    });

  }else if(dataType=="应急避难场所"){
    getEmergencyShelterDataById(id).then((response) => {
      nextTick(() => {
        console.log(response.data);
        selectDataResult.value = response.data.rows;
        console.log("选中查看详情数据");
        console.log(selectDataResult.value);
        detailTable.value = true;//打开下方查看详情面板
      });
    });

  }else if(dataType=="医院"){
    getHospitalDataById(id).then((response) => {
      nextTick(() => {
        console.log(response.data);
        selectDataResult.value = response.data.rows;
        console.log("选中查看详情数据");
        console.log(selectDataResult.value);
        detailTable.value = true;//打开下方查看详情面板
      });
    });

  }else if(dataType=="房屋抗震能力分区图"){
    getKangZhenTuDataById(id).then((response) => {
      nextTick(() => {
        console.log(response.data);
        selectDataResult.value = response.data.rows;
        console.log("选中查看详情数据");
        console.log(selectDataResult.value);
        detailTable.value = true;//打开下方查看详情面板
      });
    });

  }
}

//关闭查看详情面板
function closeDetailResultDiv(){
  detailTable.value = false;//关闭下方查看详情面板
}

//选择数据类型，设置字段说明表格内容
function setFileInfoTableData(){
  let dataType = uploadParams.value.dataType;
  let selectfile = document.getElementById("spaceData-button-selectfile");
  if(dataType=="地形地貌（高程）" || dataType=="地形地貌（坡度）") {//tif文件
    selectfile.setAttribute("accept",".tif,.*");
  }else{//shp文件
    selectfile.setAttribute("accept",".shp,.dbf,.prj,.sbn,.sbx,.shp.xml,.shx,.cpg");
  }
  //清空
  fieldInfoData.value = [];
  //根据数据类型设置字段说明表格内容
  if(dataType=="行政区划"){
    uploadParams.value.spaceType = "面";
    fieldInfoData.value = [
      {number: "1", type: "文本型", require: "否", name: "市", example: "需在上传面板选择市或在属性表中填写；示例：重庆市"},
      {number: "2", type: "文本型", require: "否", name: "区县", example: "需在上传面板选择区县或在属性表中填写；示例：渝中区"},
      {number: "3", type: "文本型", require: "是", name: "街道、乡镇", example: "示例：菜园坝街道"},
      {number: "4", type: "文本型", require: "否", name: "村、社区", example: ""},
    ];
  }else if(dataType=="地形地貌（高程）"){
    uploadParams.value.spaceType = "栅格";
    fieldInfoData.value = [];
  }else if(dataType=="地形地貌（坡度）"){
    uploadParams.value.spaceType = "栅格";
    fieldInfoData.value = [];
  }else if(dataType=="人口建筑物经济公里格网"){
    uploadParams.value.spaceType = "面";
    fieldInfoData.value = [
      /*{number: "1", type: "整型", require: "是", name: "Id", example: "示例：1000"},*/
      {number: "1", type: "整型", require: "是", name: "人口（人）", example: "示例：50"},
      {number: "2", type: "双精度", require: "是", name: "建筑面积（平方米）", example: "示例：4186.97072"},
      {number: "3", type: "双精度", require: "是", name: "GDP（万元）", example: "示例：148.12"},
      {number: "4", type: "文本型", require: "是", name: "城镇/农村", example: "城镇、农村"},
      {number: "5", type: "文本型", require: "是", name: "省", example: "示例：重庆市"},
      {number: "6", type: "文本型", require: "是", name: "市", example: "示例：重庆市"},
      {number: "7", type: "文本型", require: "是", name: "区县", example: "示例：渝中区"},
      {number: "8", type: "文本型", require: "否", name: "乡镇", example: "示例：菜园坝街道"},
      {number: "9", type: "双精度", require: "否", name: "高层建筑占比（%）", example: "保留2位小数，示例：5.00"},
      {number: "10", type: "双精度", require: "否", name: "钢结构占比（%）", example: "保留2位小数，示例：15.00"},
      {number: "11", type: "双精度", require: "否", name: "多层钢筋混凝土结构占比（%）", example: "保留2位小数，示例：20.00"},
      {number: "12", type: "双精度", require: "否", name: "砖混结构占比（%）", example: "保留2位小数，示例：20.00"},
      {number: "13", type: "双精度", require: "否", name: "砖木结构占比（%）", example: "保留2位小数，示例：10.00"},
      {number: "14", type: "双精度", require: "否", name: "土结构占比（%）", example: "保留2位小数，示例：10.00"},
      {number: "15", type: "双精度", require: "否", name: "木结构占比（%）", example: "保留2位小数，示例：10.00"},
      {number: "16", type: "双精度", require: "否", name: "石结构占比（%）", example: "保留2位小数，示例：10.00"},
      {number: "17", type: "双精度", require: "否", name: "其他结构占比（%）", example: "保留2位小数，示例：0.00；以上9种结构类型占比之和应为100%"},
      {number: "18", type: "双精度", require: "否", name: "住宅房屋占比（%）", example: "若填写了结构类型占比则应填写住宅房屋占比（%），保留2位小数，示例：25.00"},
    ];
  }else if(dataType=="交通（道路）"){
    uploadParams.value.spaceType = "线";
    fieldInfoData.value = [
      /*{number: "1", type: "整型", require: "是", name: "Id", example: "示例：1000"},*/
      {number: "1", type: "文本型", require: "是", name: "名称", example: ""},
      {number: "2", type: "文本型", require: "是", name: "类型", example: "桥、高速路、国道、省道、县道、乡道、专用公路、其他公路"},
    ];
  }else if(dataType=="交通（机场）"){
    uploadParams.value.spaceType = "点";
    fieldInfoData.value = [
      /*{number: "1", type: "整型", require: "是", name: "Id", example: "示例：1000"},*/
      {number: "1", type: "双精度", require: "是", name: "经度", example: "示例：119.18"},
      {number: "2", type: "双精度", require: "是", name: "纬度", example: "示例：35.2"},
      {number: "3", type: "文本型", require: "是", name: "名称", example: "示例：重庆江北国际机场"},
    ];
  }else if(dataType=="水库"){
    uploadParams.value.spaceType = "点";
    fieldInfoData.value = [
      /*{number: "1", type: "整型", require: "是", name: "Id", example: "示例：1000"},*/
      {number: "1", type: "双精度", require: "是", name: "经度", example: "示例：119.18"},
      {number: "2", type: "双精度", require: "是", name: "纬度", example: "示例：35.2"},
      {number: "3", type: "文本型", require: "是", name: "名称", example: "示例：迎龙湖水库"},
      {number: "4", type: "文本型", require: "是", name: "规模", example: "示例：中型"},
      {number: "5", type: "双精度", require: "是", name: "库容量（万立方米）", example: "示例：1798"},
      {number: "6", type: "文本型", require: "是", name: "结构类型", example: "示例：土重力坝"},
      {number: "7", type: "文本型", require: "是", name: "建造年代", example: "示例：00年代"},
    ];
  }else if(dataType=="学校"){
    uploadParams.value.spaceType = "点";
    fieldInfoData.value = [
      /*{number: "1", type: "整型", require: "是", name: "Id", example: "示例：1000"},*/
      {number: "1", type: "双精度", require: "是", name: "经度", example: "示例：119.18"},
      {number: "2", type: "双精度", require: "是", name: "纬度", example: "示例：35.2"},
      {number: "3", type: "文本型", require: "是", name: "名称", example: "示例：重庆市南坪中学校"},
      {number: "4", type: "文本型", require: "是", name: "类型", example: "示例：中学"},
      {number: "5", type: "整型", require: "是", name: "学生人数", example: "示例：6300"},
      {number: "6", type: "文本型", require: "是", name: "是否寄宿学校", example: "是、否"},
    ];
  }else if(dataType=="地质灾害"){
    uploadParams.value.spaceType = "点";
    fieldInfoData.value = [
      /*{number: "1", type: "整型", require: "是", name: "Id", example: "示例：1000"},*/
      {number: "1", type: "双精度", require: "是", name: "经度", example: "示例：119.18"},
      {number: "2", type: "双精度", require: "是", name: "纬度", example: "示例：35.2"},
      {number: "3", type: "文本型", require: "是", name: "名称", example: "示例：报恩堂不稳定斜坡"},
      {number: "4", type: "文本型", require: "是", name: "灾害类型", example: "示例：滑坡"},
      {number: "5", type: "整型", require: "否", name: "影响人口数量", example: "示例：15"},
      {number: "6", type: "整型", require: "否", name: "影响房屋数量", example: "示例：3"},
      {number: "7", type: "文本型", require: "是", name: "稳定性", example: "示例：稳定性好"},
      {number: "8", type: "文本型", require: "是", name: "危险等级", example: "示例：小型"},
    ];
  }else if(dataType=="断层"){
    uploadParams.value.spaceType = "线";
    fieldInfoData.value = [
      {number: "1", type: "文本型", require: "是", name: "断层编号", example: ""},
      {number: "2", type: "文本型", require: "是", name: "断层名称", example: ""},
      {number: "3", type: "整型", require: "否", name: "断层走向[度]", example: ""},
    ];
  }else if(dataType=="次生灾害危险源（危化企业）"){
    uploadParams.value.spaceType = "点";
    fieldInfoData.value = [
      /*{number: "1", type: "整型", require: "是", name: "Id", example: "示例：1000"},*/
      {number: "1", type: "双精度", require: "是", name: "经度", example: "示例：119.18"},
      {number: "2", type: "双精度", require: "是", name: "纬度", example: "示例：35.2"},
      {number: "3", type: "文本型", require: "是", name: "企业名", example: "示例：重庆力宏精细化工有限公司"},
      {number: "4", type: "文本型", require: "是", name: "地址", example: "示例：重庆市南岸区江峡路6号"},
      {number: "5", type: "文本型", require: "是", name: "危化品类型", example: "示例：乙醇，回收套用"},
      {number: "6", type: "文本型", require: "是", name: "规模", example: "示例：116000吨/年，蒸馏法"},
      {number: "7", type: "文本型", require: "是", name: "风险等级", example: "示例：一级"},
      {number: "8", type: "整型", require: "是", name: "是否重点隐患", example: "候选：1(是)、0(否)。示例：1"},
    ];
  }else if(dataType=="次生灾害危险源（加油站）"){
    uploadParams.value.spaceType = "点";
    fieldInfoData.value = [
      /*{number: "1", type: "整型", require: "是", name: "Id", example: "示例：1000"},*/
      {number: "1", type: "双精度", require: "是", name: "经度", example: "示例：119.18"},
      {number: "2", type: "双精度", require: "是", name: "纬度", example: "示例：35.2"},
      {number: "3", type: "文本型", require: "是", name: "名称", example: "示例：中国石油天然气股份有限公司重庆销售分公司海峡路加油站"},
      {number: "4", type: "文本型", require: "是", name: "地址", example: "示例：重庆市经济技术开发区海峡路南侧"},
      {number: "5", type: "文本型", require: "是", name: "规模", example: "示例：1级"},
      {number: "6", type: "文本型", require: "是", name: "风险等级", example: "示例：一级"},
      {number: "7", type: "整型", require: "是", name: "是否重点隐患", example: "候选：1(是)、0(否)。示例：1"},
    ];
  }else if(dataType=="应急避难场所"){
    uploadParams.value.spaceType = "点";
    fieldInfoData.value = [
      /*{number: "1", type: "整型", require: "是", name: "Id", example: "示例：1000"},*/
      {number: "1", type: "双精度", require: "是", name: "经度", example: "示例：119.18"},
      {number: "2", type: "双精度", require: "是", name: "纬度", example: "示例：35.2"},
      {number: "3", type: "文本型", require: "是", name: "名称", example: "示例：重庆十一中学校"},
      {number: "4", type: "文本型", require: "是", name: "类型", example: "短期、暂时、中长期"},
      {number: "5", type: "文本型", require: "是", name: "具体地址", example: "示例：弹新街57号"},
      {number: "6", type: "整型", require: "是", name: "可容纳人数", example: "示例：10000"},
      {number: "7", type: "文本型", require: "是", name: "有无应急保障设备", example: "示例：有"},
    ];
  }else if(dataType=="医院"){
    uploadParams.value.spaceType = "点";
    fieldInfoData.value = [
      /*{number: "1", type: "整型", require: "是", name: "Id", example: "示例：1000"},*/
      {number: "1", type: "双精度", require: "是", name: "经度", example: "示例：119.18"},
      {number: "2", type: "双精度", require: "是", name: "纬度", example: "示例：35.2"},
      {number: "3", type: "文本型", require: "是", name: "名称", example: "示例：北京大学第三医院"},
      {number: "4", type: "文本型", require: "是", name: "类型", example: "示例：三级甲等"},
      {number: "5", type: "整型", require: "是", name: "医疗力量（人数）", example: "示例：1000"},
      {number: "6", type: "整型", require: "是", name: "床位数", example: "示例：500"},
      {number: "7", type: "文本型", require: "否", name: "地址", example: "示例：北京市海淀区花园北路49号"},
    ];
  }else if(dataType=="房屋抗震能力分区图"){
    uploadParams.value.spaceType = "面";
    fieldInfoData.value = [
      {number: "1", type: "文本型", require: "是", name: "Id", example: "示例：50010301200000001"},
      {number: "2", type: "文本型", require: "是", name: "区（县）", example: "示例：渝中区"},
      {number: "3", type: "文本型", require: "是", name: "街道、乡镇", example: "示例：大坪街道"},
      {number: "4", type: "文本型", require: "否", name: "村、社区", example: ""},
      {number: "5", type: "文本型", require: "是", name: "抗震能力初判结果", example: "示例：估计抗震能力达标"},
      {number: "6", type: "整型", require: "是", name: "当前抗震能力下房屋栋数", example: "示例：4"},
      {number: "7", type: "整型", require: "是", name: "面积", example: "示例：34502"},
    ];
    //清空区县内容
    uploadParams.value.county = null;
  }
}

//显示字段说明dialog
function showFieldDialog(){
  if(uploadParams.value.dataType!=null && uploadParams.value.dataType!=""){
    fieldInfoVisible.value = true;
  }else{
    alertMsg("请先选择数据类型!");
  }
}

//显示隐藏图层选择面板
function showHideLayerDiv(){
  if(showHideLayerDivBool.value){
    showHideLayerDivBool.value = false;
  }else{
    showHideLayerDivBool.value = true;
  }
}

//显示隐藏图例面板
function showHideLegendDiv(){
  if(showHideLegendDivBool.value){
    showHideLegendDivBool.value = false;//显示图例面板
  }else{
    showHideLegendDivBool.value = true;//隐藏图例面板
    rkgwLegendBool.value = false;//隐藏人口建筑物经济公里格网图例
    elevationLegendBool.value = false;//隐藏高程图例
    slopeLegendBool.value = false;//隐藏坡度图例
    fwkznlLegendBool.value = false;//隐藏房屋抗震能力分区图图例
  }
}

//显示隐藏文字图层
function showHideTextLayer(){
  if(showHideTextLayerBool.value){
    showHideTextLayerBool.value = false;//隐藏文字图层
  }else{
    showHideTextLayerBool.value = true;//显示文字图层
  }
  //选择国家级或省级图层事件
  layerRadioSelect();
}

//勾选图层事件
function chooseLayers(value){
  console.log(value);
  console.log("勾选图层事件");
  console.log(layerSelectData.value);
  let tempArray = ["行政区划","高程","坡度","人口建筑物经济公里格网","道路","机场","水库","学校","地质灾害","断层","危化企业","加油站","应急避难场所","医院","房屋抗震能力分区图"];
  let indexArray = [];
  let array = layerSelectData.value;
  if(array.length>0){
    for(let i=0;i<array.length;i++){
      let arr = array[i];
      let name = arr[0];
      if(arr.length==2){
        name = arr[1];
      }
      let index = tempArray.indexOf(name);
      indexArray.push(index);//设置勾选的数组序号
    }
  }
  console.log(indexArray);
  let oldIndexArray = [];
  let oldArray = tempLayerSelectData.value;//上一次图层选择内容
  if(oldArray.length>0){
    for(let i=0;i<oldArray.length;i++){
      let arr = oldArray[i];
      let name = arr[0];
      if(arr.length==2){
        name = arr[1];
      }
      let index = tempArray.indexOf(name);
      oldIndexArray.push(index);//设置勾选的数组序号
    }
  }
  console.log(oldIndexArray);
  for(let i=0;i<tempArray.length;i++){
    let layerName = tempArray[i];
    let bool = false;
    if(indexArray.indexOf(i)!=-1){//是否勾选
      bool = true;
    }
    let oldBool = false;
    if(oldIndexArray.indexOf(i)!=-1){//是否勾选
      oldBool = true;
      if(bool){//上一次已勾选，本次已勾选，跳过
        continue;
      }
    }else{
      if(bool==false){//上一次未勾选，本次未勾选，跳过
        continue;
      }
    }
    let queryBool = false;//是否查询图层数据
    let dataType = layerName;//数据类型
    if(layerName=="行政区划"){
      //未勾选
      if(bool==false){
        //清空图层数据
        xzqhAllData.value = [];
      }else if(xzqhLayerBool.value==false){
        queryBool = true;
      }
      xzqhLayerBool.value = bool;
    }else if(layerName=="高程"){//地形地貌（高程）
      dataType = "地形地貌（高程）";//数据类型
      //未勾选
      if(bool==false){
        //清空图层数据
        dxdmGcAllData.value = [];
        elevationLegendBool.value = false;//隐藏高程图例
      }else if(dxdmGcLayerBool.value==false){
        queryBool = true;
      }
      dxdmGcLayerBool.value = bool;
    }else if(layerName=="坡度"){//地形地貌（坡度）
      dataType = "地形地貌（坡度）";//数据类型
      //未勾选
      if(bool==false){
        //清空图层数据
        dxdmPdAllData.value = [];
        slopeLegendBool.value = false;//隐藏坡度图例
      }else if(dxdmPdLayerBool.value==false){
        queryBool = true;
      }
      dxdmPdLayerBool.value = bool;
    }else if(layerName=="人口建筑物经济公里格网"){
      //未勾选
      if(bool==false){
        //清空图层数据
        rkgwAllData.value = [];
        rkgwLegendBool.value = false;//隐藏人口建筑物经济公里格网图例
      }else if(rkgwLayerBool.value==false){
        queryBool = true;
      }
      rkgwLayerBool.value = bool;
    }else if(layerName=="道路"){//交通（道路）
      dataType = "交通（道路）";//数据类型
      //未勾选
      if(bool==false){
        //清空图层数据
        jtDlAllData.value = [];
      }else if(jtDlLayerBool.value==false){
        queryBool = true;
      }
      jtDlLayerBool.value = bool;
    }else if(layerName=="机场"){//交通（机场）
      dataType = "交通（机场）";//数据类型
      //未勾选
      if(bool==false){
        //清空图层数据
        jtJcAllData.value = [];
      }else if(jtJcLayerBool.value==false){
        queryBool = true;
      }
      jtJcLayerBool.value = bool;
    }else if(layerName=="水库"){
      //未勾选
      if(bool==false){
        //清空图层数据
        skAllData.value = [];
      }else if(skLayerBool.value==false){
        queryBool = true;
      }
      skLayerBool.value = bool;
    }else if(layerName=="学校"){
      //未勾选
      if(bool==false){
        //清空图层数据
        schoolAllData.value = [];
      }else if(schoolLayerBool.value==false){
        queryBool = true;
      }
      schoolLayerBool.value = bool;
    }else if(layerName=="地质灾害"){
      //未勾选
      if(bool==false){
        //清空图层数据
        dzzhAllData.value = [];
      }else if(dzzhLayerBool.value==false){
        queryBool = true;
      }
      dzzhLayerBool.value = bool;
    }else if(layerName=="断层"){
      //未勾选
      if(bool==false){
        //清空图层数据
        dcAllData.value = [];
      }else if(dcLayerBool.value==false){
        queryBool = true;
      }
      dcLayerBool.value = bool;
    }else if(layerName=="危化企业"){//次生灾害危险源（危化企业）
      dataType = "次生灾害危险源（危化企业）";//数据类型
      //未勾选
      if(bool==false){
        //清空图层数据
        csWhqyAllData.value = [];
      }else if(csWhqyLayerBool.value==false){
        queryBool = true;
      }
      csWhqyLayerBool.value = bool;
    }else if(layerName=="加油站"){//次生灾害危险源（加油站）
      dataType = "次生灾害危险源（加油站）";//数据类型
      //未勾选
      if(bool==false){
        //清空图层数据
        csJyzAllData.value = [];
      }else if(csJyzLayerBool.value==false){
        queryBool = true;
      }
      csJyzLayerBool.value = bool;
    }else if(layerName=="应急避难场所"){
      //未勾选
      if(bool==false){
        //清空图层数据
        yjbncsAllData.value = [];
      }else if(yjbncsLayerBool.value==false){
        queryBool = true;
      }
      yjbncsLayerBool.value = bool;
    }else if(layerName=="医院"){
      //未勾选
      if(bool==false){
        //清空图层数据
        hospitalAllData.value = [];
      }else if(hospitalLayerBool.value==false){
        queryBool = true;
      }
      hospitalLayerBool.value = bool;
    }else if(layerName=="房屋抗震能力分区图"){
      //未勾选
      if(bool==false){
        //清空图层数据
        fwkznlAllData.value = [];
        fwkznlLegendBool.value = false;//隐藏房屋抗震能力分区图图例
      }else if(fwkznlLayerBool.value==false){
        queryBool = true;
      }
      fwkznlLayerBool.value = bool;
    }
    //是否查询图层数据
    if(queryBool){
      //查询图层数据
      queryLayerData(dataType);
    }else{
      //移除超图图层
      showRestLayerByType(dataType,false);
    }
  }
  tempLayerSelectData.value = layerSelectData.value;
}

//选择国家级或省级图层事件
function layerRadioSelect(){
  console.log(layerSelectData.value);
  let tempArray = ["行政区划","高程","坡度","人口建筑物经济公里格网","道路","机场","水库","学校","地质灾害","断层","危化企业","加油站","应急避难场所","医院","房屋抗震能力分区图"];
  let indexArray = [];
  let array = layerSelectData.value;
  if(array.length>0){
    for(let i=0;i<array.length;i++){
      let arr = array[i];
      let name = arr[0];
      if(arr.length==2){
        name = arr[1];
      }
      let index = tempArray.indexOf(name);
      indexArray.push(index);//设置勾选的数组序号
    }
  }
  console.log(indexArray);
  for(let i=0;i<tempArray.length;i++){
    let layerName = tempArray[i];
    let bool = false;
    if(indexArray.indexOf(i)!=-1){//是否勾选
      bool = true;
    }
    let queryBool = false;//是否查询图层数据
    let dataType = layerName;//数据类型
    if(layerName=="行政区划"){
      //未勾选
      if(bool==false){
        //清空图层数据
        // xzqhAllData.value = [];
      }else{
        queryBool = true;
      }
      xzqhLayerBool.value = bool;
    }else if(layerName=="高程"){//地形地貌（高程）
      dataType = "地形地貌（高程）";//数据类型
      //未勾选
      if(bool==false){
        //清空图层数据
        // dxdmGcAllData.value = [];
      }else{
        queryBool = true;
      }
      dxdmGcLayerBool.value = bool;
    }else if(layerName=="坡度"){//地形地貌（坡度）
      dataType = "地形地貌（坡度）";//数据类型
      //未勾选
      if(bool==false){
        //清空图层数据
        // dxdmPdAllData.value = [];
      }else{
        queryBool = true;
      }
      dxdmPdLayerBool.value = bool;
    }else if(layerName=="人口建筑物经济公里格网"){
      //未勾选
      if(bool==false){
        //清空图层数据
        // rkgwAllData.value = [];
      }else{
        queryBool = true;
      }
      rkgwLayerBool.value = bool;
    }else if(layerName=="道路"){//交通（道路）
      dataType = "交通（道路）";//数据类型
      //未勾选
      if(bool==false){
        //清空图层数据
        // jtDlAllData.value = [];
      }else{
        queryBool = true;
      }
      jtDlLayerBool.value = bool;
    }else if(layerName=="机场"){//交通（机场）
      dataType = "交通（机场）";//数据类型
      //未勾选
      if(bool==false){
        //清空图层数据
        // jtJcAllData.value = [];
      }else{
        queryBool = true;
      }
      jtJcLayerBool.value = bool;
    }else if(layerName=="水库"){
      //未勾选
      if(bool==false){
        //清空图层数据
        // skAllData.value = [];
      }else{
        queryBool = true;
      }
      skLayerBool.value = bool;
    }else if(layerName=="学校"){
      //未勾选
      if(bool==false){
        //清空图层数据
        // schoolAllData.value = [];
      }else{
        queryBool = true;
      }
      schoolLayerBool.value = bool;
    }else if(layerName=="地质灾害"){
      //未勾选
      if(bool==false){
        //清空图层数据
        // dzzhAllData.value = [];
      }else{
        queryBool = true;
      }
      dzzhLayerBool.value = bool;
    }else if(layerName=="断层"){
      //未勾选
      if(bool==false){
        //清空图层数据
        // dcAllData.value = [];
      }else{
        queryBool = true;
      }
      dcLayerBool.value = bool;
    }else if(layerName=="危化企业"){//次生灾害危险源（危化企业）
      dataType = "次生灾害危险源（危化企业）";//数据类型
      //未勾选
      if(bool==false){
        //清空图层数据
        // csWhqyAllData.value = [];
      }else{
        queryBool = true;
      }
      csWhqyLayerBool.value = bool;
    }else if(layerName=="加油站"){//次生灾害危险源（加油站）
      dataType = "次生灾害危险源（加油站）";//数据类型
      //未勾选
      if(bool==false){
        //清空图层数据
        // csJyzAllData.value = [];
      }else{
        queryBool = true;
      }
      csJyzLayerBool.value = bool;
    }else if(layerName=="应急避难场所"){
      //未勾选
      if(bool==false){
        //清空图层数据
        // yjbncsAllData.value = [];
      }else{
        queryBool = true;
      }
      yjbncsLayerBool.value = bool;
    }else if(layerName=="医院"){
      //未勾选
      if(bool==false){
        //清空图层数据
        // hospitalAllData.value = [];
      }else{
        queryBool = true;
      }
      hospitalLayerBool.value = bool;
    }else if(layerName=="房屋抗震能力分区图"){
      //未勾选
      if(bool==false){
        //清空图层数据
        // fwkznlAllData.value = [];
      }else{
        queryBool = true;
      }
      fwkznlLayerBool.value = bool;
    }
    //是否查询图层数据
    if(queryBool){
      //查询图层数据
      queryLayerData(dataType);
    }else{
      //移除超图图层
      showRestLayerByType(dataType,false);
    }
  }
}

//人口建筑物经济公里格网图例鼠标悬浮事件
function rkgwLegendMouseOver(){
  rkgwLegendBool.value = true;
  elevationLegendBool.value = false;//隐藏高程图例
  slopeLegendBool.value = false;//隐藏坡度图例
  fwkznlLegendBool.value = false;//隐藏房屋抗震能力分区图图例
}

//人口建筑物经济公里格网图例选择事件
function rkgwLegendRadioSelect(){
  let value = rkgwLegendRadio.value;
  let rkgwType = "";
  if(value=="1"){//人口
    rkgwLegendSelectData.value = ["人口",rkgwLegendData1.value];
    rkgwType = "人口公里格网";
  }else if(value=="2"){//建筑物
    rkgwLegendSelectData.value = ["建筑物",rkgwLegendData2.value];
    rkgwType = "建筑物公里格网";
  }else if(value=="3"){//经济
    rkgwLegendSelectData.value = ["经济",rkgwLegendData3.value];
    rkgwType = "经济公里格网";
  }
  if(rkgwType){
    showRestLayerByType(rkgwType,true);
  }
}
// 权限
const isAdmin = async () => {
    let res = await getLanderRoles()
    const { code, data } = res
    if(code == 200) {
        const auth = data.split(',')
        return auth
    }else {
        return Promise.reject(new Error(data))
    }
}
const defaultProvice = ref('')
const getDefaultProvice = async () => {
    try {
        let curAuth = await isAdmin()
        const type1 = curAuth.length == 1 && (curAuth.includes('省管理员') || curAuth.includes('省业务员'))
        const type2 = curAuth.length == 2 && curAuth.includes('省管理员') && curAuth.includes('省业务员')
        console.log(type1 || type2)
        if(type1 || type2){
            getLanderProvince().then(res => {
                if(res.code == 200){
                    const curProvice = provinceData.value.find(item => {
                      return item.id == res.data
                    })
                    defaultProvice.value = curProvice;
                    //设置默认权限所在省
                    provinceData.value = [curProvice];
                    //图层查询参数--省
                    layerDataQueryParams.value.province = curProvice.name;
                }
            })
        }
    } catch (error) {
        
    }
}

watchEffect(() => {
  if(showHideUploadDivBool.value){
    uploadParams.value.province = defaultProvice.value.name
    chooseProvince(defaultProvice.value)
  }
  if(showHideManageDivBool.value || showHideQueryDivBool.value){
    queryParams.value.province = defaultProvice.value.name
    chooseProvince(defaultProvice.value)
  }
})

//高程图例鼠标悬浮事件
function elevationLegendMouseOver(){
  elevationLegendBool.value = true;//显示高程图例
  slopeLegendBool.value = false;//隐藏坡度图例
  rkgwLegendBool.value = false;//隐藏人口建筑物经济公里格网图例
  fwkznlLegendBool.value = false;//隐藏房屋抗震能力分区图图例
}

//坡度图例鼠标悬浮事件
function slopeLegendMouseOver(){
  slopeLegendBool.value = true;//显示坡度图例
  elevationLegendBool.value = false;//隐藏高程图例
  rkgwLegendBool.value = false;//隐藏人口建筑物经济公里格网图例
  fwkznlLegendBool.value = false;//隐藏房屋抗震能力分区图图例
}

//房屋抗震能力分区图图例鼠标悬浮事件
function fwkznlLegendMouseOver(){
  fwkznlLegendBool.value = true;//显示房屋抗震能力分区图图例
  slopeLegendBool.value = false;//隐藏坡度图例
  elevationLegendBool.value = false;//隐藏高程图例
  rkgwLegendBool.value = false;//隐藏人口建筑物经济公里格网图例
}

//使用回显数据字典的方法
const sfzdyhDictData = (value) => {
  //是否重点隐患-字典格式
  let zidian = [
    { value:1, label:'是' },
    { value:0, label:'否' }
  ];
  for(let i=0;i<zidian.length;i++){
    if(zidian[i].value==value){
      value = zidian[i].label;
    }
  }
  return value;
}

//开启空间统计查询功能
function queryChartsView(){
  //空间统计查询参数
  chartViewQueryParams.value.province = queryParams.value.province;
  chartViewQueryParams.value.city = queryParams.value.city;
  chartViewQueryParams.value.county = queryParams.value.county;
  chartViewQueryParams.value.provinceId = queryParams.value.provinceId;
  chartViewQueryParams.value.cityId = queryParams.value.cityId;
  chartViewQueryParams.value.countyId = queryParams.value.countyId;
  chartViewQueryParams.value.dataType = queryParams.value.dataType;//数据类型
  chartViewQueryParams.value.geomText = "";//地图圈选空间数据
  let title = "";
  if(queryParams.value.province!=null){
    title += queryParams.value.province;
  }
  if(queryParams.value.city!=null){
    title += queryParams.value.city;
  }
  if(queryParams.value.county!=null){
    title += queryParams.value.county;
  }
  title += "【" + queryParams.value.dataType +"】";
  chartViewQueryParams.value.title = title + "查询空间统计结果";//标题
  //显示空间统计
  chartViewQueryParams.value.showBool = true;
  queryMapBool.value = false;//关闭地图圈选查询
}
const queryMapBool = ref(false);//是否开启地图圈选查询
//地图圈选查询空间统计
function queryMapClick(){
  //空间统计查询参数
  chartViewQueryParams.value.province = "";
  chartViewQueryParams.value.city = "";
  chartViewQueryParams.value.county = "";
  chartViewQueryParams.value.provinceId = "";
  chartViewQueryParams.value.cityId = "";
  chartViewQueryParams.value.countyId = "";
  chartViewQueryParams.value.dataType = queryParams.value.dataType;//数据类型
  chartViewQueryParams.value.geomText = "";//地图圈选空间数据
  //清空省市县查询条件
  queryParams.value.province = null;
  queryParams.value.city = null;
  queryParams.value.county = null;
  queryParams.value.provinceId = null;
  queryParams.value.cityId = null;
  queryParams.value.countyId = null;
  cityData.value = [];
  areaData.value = [];
  //查询数据类型
  let dataType = queryParams.value.dataType;
  if(dataType==null){
    dataType = "";
  }
  if(dataType===""){
    alertMsg("请选择数据类型!");
    return;
  }
  queryMapBool.value = false;//关闭地图圈选查询
  nextTick(() => {
    queryMapBool.value = true;//开启地图圈选查询
  });
}
//关闭空间统计
const hideChartView = (bool)=>{
  //关闭空间统计
  chartViewQueryParams.value.showBool = bool;
}

function importTemplate(name) {// 模板下载
  if(name=="人口建筑物经济公里格网"){
    name = "人口建筑物经济公里网格";
  }
  proxy.download("/fxfzypg/baseData/downloadShpZip", {
    fileName: name
  }, name+".zip");
}

function getDataTypeInfo(dataType){
  let dataTypeInfo = null;
  let array = dataTypeInfoArray.value;
  for(let i=0;i<array.length;i++){
    if(array[i].name==dataType){
      dataTypeInfo = array[i];
      break;
    }
  }

  return dataTypeInfo;
}

//是否已有图层
function isLayerBool(layerId) {
  let bool = false;
  let layers = map.value.getLayers();
  layers.forEach((layer) => {
    if(layer){
      let lid = layer.get('id');
      if (lid) {
        if (lid.indexOf(layerId) != -1) {
          bool = true;
        }
      }
    }
  });
  return bool;
}

//是否已有图层并移除图层
function removeLayerBool(layerId) {
  let bool = false;
  let layers = map.value.getLayers();
  console.log("是否已有图层并移除图层");
  console.log(layers);
  layers.forEach((layer) => {
    if(layer){
      let lid = layer.get('id');
      if (lid) {
        if (lid.indexOf(layerId) != -1) {
          bool = true;
          map.value.removeLayer(layer);
        }
      }
    }
  });
  return bool;
}

//显示|移除超图图层
function showRestLayerByType(dataType,showBool){
  if(showBool && dataType.indexOf("公里格网")!=-1) {
    if (dataType == "人口建筑物经济公里格网") {
      let rkgwType = rkgwLegendRadio.value;
      if (rkgwType == "1") {
        dataType = "人口公里格网";
        removeLayerBool("data_pbe_population");
      } else if (rkgwType == "2") {
        dataType = "建筑物公里格网";
        removeLayerBool("data_pbe_building");
      } else if (rkgwType == "3") {
        dataType = "经济公里格网";
        removeLayerBool("data_pbe_gdp");
      }
    }
    if (dataType == "人口建筑物经济公里格网") {
      removeLayerBool("data_pbe_population");
      removeLayerBool("data_pbe_building");
      removeLayerBool("data_pbe_gdp");
    } else if (dataType == "人口公里格网") {
      removeLayerBool("data_pbe");
      removeLayerBool("data_pbe_building");
      removeLayerBool("data_pbe_gdp");
    } else if (dataType == "建筑物公里格网") {
      removeLayerBool("data_pbe");
      removeLayerBool("data_pbe_population");
      removeLayerBool("data_pbe_gdp");
    } else if (dataType == "经济公里格网") {
      removeLayerBool("data_pbe");
      removeLayerBool("data_pbe_population");
      removeLayerBool("data_pbe_building");
    }
  }
  let dataTypeInfo = getDataTypeInfo(dataType);
  if(dataTypeInfo){
    let url = dataTypeInfo.url;
    let layerId = dataTypeInfo.code;
    let sqlFilter = dataTypeInfo.sqlFilter;//未删除的sql过滤条件
    let zIndex = dataTypeInfo.zIndex;
    //是否已有图层并移除图层
    removeLayerBool(layerId);
    if(showBool && dataType!="地形地貌（高程）" && dataType!="地形地貌（坡度）"){
      let province = layerDataQueryParams.value.province;
      let city = layerDataQueryParams.value.city;
      let county = layerDataQueryParams.value.county;
      let sqlText = sqlFilter;
      if(province){
        sqlText += " and province='"+province+"'";
      }
      if(city){
        sqlText += " and city='"+city+"'";
      }
      if(county){
        sqlText += " and county='"+county+"'";
      }
      let showLabelBool = showHideTextLayerBool.value;//是否显示文字标签子图层
      //添加超图临时图层
      getSqlTempLayer(url,sqlText,showLabelBool).then((layer) => {
        layer.set('id', layerId);
        layer.setZIndex(zIndex);
        map.value.addLayer(layer);
        loading.value = false;
      }).catch(() => {
        loading.value = false;
      });

      /*//添加超图整个图层
      getGridLayer(url).then((layer) => {
        layer.set('id', layerId);
        layer.setZIndex(6);
        console.log(layer);
        map.value.addLayer(layer);
        loading.value = false;
      }).catch(() => {
        loading.value = false;
      });*/
    }else if(showBool && (dataType=="地形地貌（高程）" || dataType=="地形地貌（坡度）")){
      let province = layerDataQueryParams.value.province;
      let city = layerDataQueryParams.value.city;
      let county = layerDataQueryParams.value.county;
      let query = {
        province: province,
        city: city,
        county: county,
        dataType: dataType,//数据类型
      };
      getAllFile(query).then((response) => {
        nextTick(() => {
          let list = response.data.rows;
          //获取超图tif文件图层
          getSuperMapTifLayer(list);
        });
      });
    }
  }else{
    loading.value = false;
  }
}

//根据经纬度查询所有显示图层要素信息
function queryShowLayerFeatureByLonLat(lonlat){
  if(lonlat!=null && lonlat.length==2){
    loading.value = true;
    let zoom = map.value.getView().getZoom();
    let layers = map.value.getLayers();
    let array = dataTypeInfoArray.value;
    let totalLength = array.length;
    let count = 0;
    let resultDataTypeInfo = null;//已查询到图层要素结果的数据类型信息
    let resultDataId = null;//已查询到的图层要素主键ID
    let resultDataFeature = null;//已查询到的图层要素数据
    let proms = [];
    for(let i=0;i<totalLength;i++){
      let dataTypeInfo = array[i];
      let databaseName = dataTypeInfo.database;
      let tableName = dataTypeInfo.table;
      let sqlFilter = dataTypeInfo.sqlFilter;//未删除的sql过滤条件
      let layerId = dataTypeInfo.code;
      if(isLayerBool(layerId)){
        const prom = queryFeatureByLonLat(databaseName, tableName, lonlat, dataTypeInfo, sqlFilter, zoom, null);
        proms.push(prom);
        console.log(i+","+count+","+prom[1]);
        count++;
      }else{
        console.log(i+","+count+","+null);
        count++;
        completeQueryShowLayerFeatureByLonLat(totalLength,count,resultDataTypeInfo,resultDataId,resultDataFeature);
      }
    }
    Promise.all(proms).then((res) => {
      let allResultArray = [];
      res.forEach((item, index) => {
        allResultArray.push(item);
      });
      Promise.all(allResultArray).then((result) => {
        result.forEach((item, index) => {
          let resultArray = item;
          console.log("resultArray");
          console.log(resultArray);
          if(resultArray[1] && resultArray[2]){
            let dataTypeInfo = resultArray[0];
            let id = resultArray[1];
            let feature = resultArray[2];
            if(resultDataTypeInfo){//已查询到图层要素结果的数据类型信息
              if(resultDataTypeInfo.zIndex < dataTypeInfo.zIndex){//图层顺序大的优先查询
                resultDataTypeInfo = dataTypeInfo;
                resultDataId = id;
                resultDataFeature = feature;
              }
            }else{
              resultDataTypeInfo = dataTypeInfo;
              resultDataId = id;
              resultDataFeature = feature;
            }
          }
        });
        completeQueryShowLayerFeatureByLonLat(totalLength,count,resultDataTypeInfo,resultDataId,resultDataFeature);
      });
    });
  }
}

//完成根据经纬度查询所有显示图层要素信息
function completeQueryShowLayerFeatureByLonLat(totalLength,count,resultDataTypeInfo,resultDataId,resultDataFeature){
  if(count==totalLength){
    if(resultDataId){
      let datatype = resultDataTypeInfo.name;
      console.log("complete--"+resultDataId+","+datatype);
      console.log("resultDataFeature");
      console.log(resultDataFeature);
      showDetailId([resultDataId,datatype]);
    }
    loading.value = false;
  }
}


//获取省列表
getProvinceData();
getDefaultProvice()
</script>
<style scoped lang="scss">
//上传面板
.new-uploadDiv{
  position:absolute;
  top:16px;
  left:100px;
  width:358px;
  height:500px;
  background-color:#fff;
  box-shadow: 0px 0px 20px rgba(0,0,0,0.2);
  border:1px solid #707070;
  border-radius: 4px;
}
.new-uploadDiv-inner {
  position:absolute;
  top:20px;
  left:30px;
  right:30px;
  bottom:0px;
}
.new-fileBtn {
  position: absolute;
  top: 190px;
  left: 0px;
  width: 70px;
}
.new-fieldInfoBtn{
  position: absolute;
  top: 210px;
  left: 15px;
  width: 70px;
  color:var(--el-color-primary);
}
.new-filesTextArea{
  position: absolute;
  left: 80px;
  top: 190px;
  right:0px;
  height:200px;
}
.new-uploadBtnDiv {
  position: absolute;
  left: 80px;
  right:0px;
  bottom:20px;
}
.new-closeBtnDiv {
  position: absolute;
  /*right: 50px;*/
  right: 0px;
  bottom:20px;
}
//查询面板
.new-queryDiv{
  position:absolute;
  top:16px;
  left:100px;
  width:358px;
  height:280px;
  background-color:#fff;
  box-shadow: 0px 0px 20px rgba(0,0,0,0.2);
  border:1px solid #707070;
  border-radius: 4px;
}
.new-queryDiv-inner {
  position:absolute;
  top:20px;
  left:30px;
  right:30px;
  bottom:0px;
}
.new-queryBtnDiv {
  position: absolute;
  /*left: 80px;*/
  left: 0px;
  bottom:20px;
}
.new-queryMapBtnDiv {
  position: absolute;
  left: 104px;
  bottom:20px;
}
//查询文件结果面板
.new-queryFileResultDiv {
  position:absolute;
  top:300px;
  left:100px;
  width:358px;
  height:200px;
  background-color:#fff;
  box-shadow: 0px 0px 20px rgba(0,0,0,0.2);
  border:1px solid #707070;
  border-radius: 4px;
}
//下方查看详情面板
.new-queryResultDiv {
  position: absolute;
  left:0px;
  right:0px;
  bottom:0px;
  /*height:140px;*/
  height:200px;
  background:#fff;
  z-index: 10;
  border: 1px solid #e4e7ed;
}
.new-queryTableBtn {
  position: absolute;
  left:0px;
  right:0px;
  top:0px;
  height:50px;
  padding:10px;
}
.new-queryTableSpan{
  position: relative;
  top: -32px;
  width: 100%;
  text-align: center;
  font-weight: bold;
  font-size: 18px;
  color: var(--el-color-primary);
  display: inline-block;
  line-height: 32px;
  z-index: -1;
}
.new-queryTableDiv {
  position: absolute;
  left:0px;
  right:0px;
  top:50px;
  bottom:0px;
}

// 图层图例
.new-layerLegendDiv {
  position: absolute;
  top:20px;
  right:10px;
  width: 54px;
  height: 220px;
  background: #fff;
  box-shadow: 0px 0px 20px rgba(0,0,0,0.2);
  border:1px solid #707070;
  border-radius: 4px;
  cursor:pointer;
}
.new-layerLegendDiv p {
  padding: 10px;
  margin:0px;
}
.new-layerLegendDiv p img {
  width:25px;
  height:25px;
  margin-left: 3px;
}
.new-layerLegendDiv p span {
  width:32px;
  height:21px;
  font-size: 14px;
  color:#3a385e;
  text-align:center;
  line-height:24px;
  border:0.5px solid #f5f5f5;
}
.new-layerLengendDiv-split {
  width: 32px!important;
  height: 1px!important;
  padding: 0px!important;
  margin: 0px!important;
  margin-left: 10px!important;
  border-top: 1px dashed #6f7ea8;
}
.new-layerSelectDiv {
  position: absolute;
  top: 20px;
  right: 70px;
  width: 256px;
  height: 110px;
  background: #fff;
  box-shadow: 0px 0px 20px rgb(0 0 0 / 20%);
  border: 1px solid #707070;
  border-radius: 4px;
  padding: 18px;
  padding-right: 0px;
}
.new-legendDiv {
  position: absolute;
  top: 140px;
  right: 70px;
  width: 256px;
  background: #fff;
  box-shadow: 0px 0px 20px rgb(0 0 0 / 20%);
  border: 1px solid #707070;
  border-radius: 4px;
  padding: 5px;
}
.new-legendDiv div {
  position: relative;
  height: 16px;
  line-height: 16px;
  font-size: 13px;
  margin: 8px;
}
.new-legendDiv div span {
  line-height: 16px;
  font-size: 13px;
}
.new-legendDiv div div {
  position: relative;
  top: 2px;
  left: 8px;
  width: 30px;
  height: 14px;
  margin: 0px !important;
  margin-right: 25px !important;
  display: inline-block;
}
/*面*/
.new-legendDiv-polygon {
  position: relative !important;
  left: 0px !important;
  top: 0px !important;
  border:1px solid black;
  background:#fff;
}
/*线*/
.new-legendDiv-line {
  position: relative !important;
  height: 5px !important;
  top: -4px !important;
  left: 0px !important;
}
/*点*/
.new-legendDiv-point {
  position: relative !important;
  left: 8px !important;
  top: 0px !important;
  height: 12px !important;
  width: 12px !important;
  border-radius: 10px !important;
  /*height: 4px !important;
  width: 4px !important;
  border-radius: 4px !important;*/
}
/*人口建筑物经济公里格网图例*/
.new-rkgwLegendDiv {
  position: absolute;
  top: 140px;
  right: 340px;
  /*width: 256px;*/
  background: #fff;
  box-shadow: 0px 0px 20px rgb(0 0 0 / 20%);
  border: 1px solid #707070;
  border-radius: 4px;
  padding: 5px;
}
.new-rkgwLegendDiv div {
  position: relative;
  height: 16px;
  line-height: 16px;
  font-size: 13px;
  margin: 8px;
}
.new-rkgwLegendDiv div span {
  line-height: 16px;
  font-size: 13px;
}
.new-rkgwLegendDiv div div {
  position: relative;
  top: 2px;
  left: 8px;
  width: 30px;
  height: 14px;
  margin: 0px !important;
  margin-right: 25px !important;
  display: inline-block;
}
</style>